Newer
Older
# Installation
This has only been tested on Linux. But it should work the same way for MacOS or Windows WSL.
## Repository
Clone this repository on your computer:
```sh
git clone https://git.ubicast.net/mediaserver/envsetup.git
# enter inside the cloned repository
cd envsetup/
```
Every commands are assumed to be launched from the envsetup directory.
## Make
For convenience we use the `make` tool, please install it.
For example, on a Debian-based distribution:
```sh
sudo apt install make
```
Otherwise you can look at the `Makefile` to see which commands are ran.
## Ansible
There are many way to install Ansible, choose one below.
### Virtual environment
```sh
NB: this is store in /tmp/venv which will be erased after a reboot
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
Alternatively you can manually create a virtual environment with [Python's venv](https://docs.python.org/3/library/venv.html) or with the package [virtualenv](https://virtualenv.pypa.io/en/stable/). For this example i will use the former one.
```sh
# create the venv
python3 -m venv .venv
# activate the venv
source .venv/bin/activate
# install requirements (inside the activated venv)
python3 -m pip install -U pip wheel
python3 -m pip install -r requirements.txt
```
If you want to exit the venv:
```sh
deactivate
```
### Docker
If you do not want to bother with Python, virtual environment and Ansible on your computer (even though it is isolated inside a venv), you can use [Docker](https://docs.docker.com/install/).
```sh
docker run \
`# run an interactive pseudo-TTY` \
-it \
`# remove the container once you leave it` \
--rm \
`# share the current directory` \
-v $(pwd):/workspace \
`# share your SSH configuration` \
-v $HOME/.ssh:/home/code/.ssh:ro \
`# share your SSH agent` \
-v $SSH_AUTH_SOCK:/ssh-agent:ro \
`# let container know where is mapped the SSH agent` \
-e SSH_AUTH_SOCK=/ssh-agent \
`# container image to use` \
registry.ubicast.net/mediaserver/envsetup \
`# executable to run` \
bash
```
Make sur to share your SSH configuration with the Docker container, this may require to adapt the example command.
### Pip
You can also install Ansible and its dependencies on your operating system, but it is not recommend since it may conflicts with existing packages.
This will install requirements into your user's path (`~/.local/bin` must be in your `PATH` in order to work):
```sh
python3 -m pip install --user -r requirements.txt
```
Even least recommended, install into system's path:
```sh
sudo python3 -m pip install -r requirements.txt
```
### Distribution packages
Depending on your distribution you may be able to install Ansible from repositories, but the provided version may be outdated (< 2.8 will certainly not work).
For example, on a Debian-based distribution:
```sh
sudo apt install \
ansible \
python3-netaddr \
python3-pyyaml \
```
Take a look at the requirements in `requirements.in` file.
## Testing
To make sure Ansible is properly installed, run this command:
```sh
ansible --version
```
The output should like like this:
```
ansible 2.9.1
config file = /workspace/ansible.cfg
configured module search path = ['/workspace/library']
ansible python module location = /home/code/pyvenv/lib/python3.7/site-packages/ansible
executable location = /home/code/pyvenv/bin/ansible
python version = 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0]
```