Browse Source

ansible: move inventory to inventories/common

keep-around/db86a59f781921171eca745f8ae6f93a2ffdf6b8
Loïc Dachary 3 years ago
parent
commit
428ff0310d
Signed by: dachary GPG Key ID: 283AFA30CA7F55A4
  1. 4
      .gitignore
  2. 4
      cookiecutter/{{cookiecutter.scenario_name}}/molecule.yml
  3. 6
      docs/ansible.rst
  4. 2
      docs/backup.rst
  5. 3
      docs/bind.rst
  6. 2
      docs/extending.rst
  7. 2
      docs/gitlab.rst
  8. 4
      docs/monitoring_howto.rst
  9. 0
      inventories/common/02-all.yml
  10. 0
      inventories/common/group_vars/all/letsencrypt_nginx_staging.yml
  11. 0
      inventories/common/group_vars/all/production_domain.yml
  12. 0
      inventories/common/host_vars/chat-host/chat.yml
  13. 0
      inventories/common/host_vars/external-host/disable-monitoring.yml
  14. 0
      inventories/common/host_vars/forum-host/forum.yml
  15. 0
      inventories/common/host_vars/gitlab-host/gitlab.yml
  16. 0
      inventories/common/host_vars/icinga-host/monitoring.yml
  17. 0
      inventories/common/host_vars/packages-host/packages.yml
  18. 0
      inventories/common/host_vars/weblate-host/weblate.yml
  19. 0
      inventories/common/host_vars/website-host/website.yml
  20. 4
      molecule/authorized_keys/molecule.yml
  21. 4
      molecule/backup/molecule.yml
  22. 4
      molecule/bind/molecule.yml
  23. 2
      molecule/certs/molecule.yml
  24. 4
      molecule/chat/molecule.yml
  25. 4
      molecule/cloud/molecule.yml
  26. 4
      molecule/enough/molecule.yml
  27. 4
      molecule/forum/molecule.yml
  28. 4
      molecule/gitlab/molecule.yml
  29. 2
      molecule/gitlab/tests/gitlab_utils.py
  30. 4
      molecule/icinga/molecule.yml
  31. 2
      molecule/icinga/tests/test_icingaweb.py
  32. 2
      molecule/icinga/tests/test_letsencrypt.py
  33. 6
      molecule/infrastructure/create.yml
  34. 4
      molecule/infrastructure/molecule.yml
  35. 4
      molecule/jdauphant.nginx/molecule.yml
  36. 4
      molecule/letsencrypt-nginx/molecule.yml
  37. 4
      molecule/misc/molecule.yml
  38. 4
      molecule/packages/molecule.yml
  39. 4
      molecule/postfix/molecule.yml
  40. 4
      molecule/preprod/molecule.yml
  41. 4
      molecule/weblate/molecule.yml
  42. 2
      molecule/weblate/tests/test_weblate.py
  43. 4
      molecule/website/molecule.yml
  44. 4
      molecule/wereport/molecule.yml

4
.gitignore

@ -5,10 +5,10 @@ __pycache__
.cache
pytestdebug.log
docs/_build/
inventory/01-hosts.yml
inventories/common/01-hosts.yml
private-key.yml
*.pyc
infrastructure_key*
secret
inventory/group_vars/all/domain.yml
inventories/common/group_vars/all/domain.yml
openrc.sh

4
cookiecutter/{{cookiecutter.scenario_name}}/molecule.yml

@ -31,8 +31,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles:../nextcloud/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: {{ cookiecutter.scenario_name }}
test_sequence:

6
docs/ansible.rst

@ -47,12 +47,12 @@ Manually create `/srv/enough-community/clouds.yml` from `~/openrc.sh` and check
Set the passwords and other secret credentialis in the file or
directory matching a given host at
`/srv/checkout/inventory/host_vars/` (so that the default used during
`/srv/checkout/inventories/common/host_vars/` (so that the default used during
testing are not used in production).
.. code::
$ echo domain: enough.community | sudo tee /srv/checkout/inventory/group_vars/all/domain.yml
$ echo domain: enough.community | sudo tee /srv/checkout/inventories/common/group_vars/all/domain.yml
Secrets
-------
@ -89,7 +89,7 @@ Inventory
The ansible inventory is created by the
``molecule/infrastructure/create.yml`` playbook and stored in the
``inventory/01-hosts.yml`` file every time the ``molecule create -s
``inventories/common/01-hosts.yml`` file every time the ``molecule create -s
preprod`` command runs. The inventory variables (such as the ssh port
number) are read from the ``hosts-base.yml`` file.

2
docs/backup.rst

@ -30,7 +30,7 @@ If the virtual machine is a pet
* Rename the broken machine if it is still around, e.g. ``openstack server set --name packages-destroyed packages-host``
* Get the flavor for the machine from ``molecule/preprod/molecule.yml``
* Create a new machine from the backup, e.g. ``openstack server create --flavor s1-2 --image 2018-05-14-packages-host --security-group infrastructure --wait packages-host``
* Edit ``inventory/01-hosts.yml`` and replace the IP of the broken machine with the IP of the new machine
* Edit ``inventories/common/01-hosts.yml`` and replace the IP of the broken machine with the IP of the new machine
* Clear the ansible cache ``rm -fr ~/.ansible``
* :doc:`Run ansible <ansible>` so the DNS updates with the IP of the newly created VM
* Reboot the machine, in case it had IPs from before the DNS was updated by ansible

3
docs/bind.rst

@ -23,7 +23,8 @@ because everything depends on it.
.. code::
ansible-playbook -l bind-host \
--private-key infrastructure_key -i inventory \
--private-key infrastructure_key \
-i inventories/common \
enough-community-playbook.yml
Mail

2
docs/extending.rst

@ -45,7 +45,7 @@ should be used to very they fit together as expected.
Adding a host
-------------
Ansible hosts are defined in `inventory/01-hosts.yml`. This file is
Ansible hosts are defined in `inventories/common/01-hosts.yml`. This file is
autogenerated by molecule scenarios and is not meant to be manually
modified.

2
docs/gitlab.rst

@ -3,7 +3,7 @@ GitLab
`lab.enough.community <http://lab.enough.community/main/infrastructure/tree/master/molecule/gitlab/roles/gitlab>`_ is installed `with docker <https://hub.docker.com/r/sameersbn/gitlab/>`_.
The configuration variables are set in `inventory/host_vars/gitlab-host.yml` at
The configuration variables are set in `inventories/common/host_vars/gitlab-host/gitlab.yml` at
the root of the repository. It can be copied from
`molecule/gitlab/roles/gitlab/defaults/main.yml`.

4
docs/monitoring_howto.rst

@ -17,7 +17,7 @@ Monitoring deployment
Monitoring is deployed by importing the
`molecule/icinga/icinga-playbook.yml` playbook. The Icinga2 master is
`icinga-host`. See also
`inventory/host_vars/icinga-host/monitoring.yml` for specific
`inventories/common/host_vars/icinga-host/monitoring.yml` for specific
deployment attributes: icingaweb credentials, https, virtualhost fqdn.
Each host is monitored by default.
@ -232,6 +232,6 @@ Hosts vars
A host can define a list of lines to be added to its icinga configuration,
using the Ansible variable ``monitoring_host_vars``. Se e.g.
``inventory/host_vars/demo-host/monitoring.yml`` for an example.
``inventories/common/host_vars/icinga-host/monitoring.yml`` for an example.
Default is empty.

0
inventory/02-all.yml → inventories/common/02-all.yml

0
inventory/group_vars/all/letsencrypt_nginx_staging.yml → inventories/common/group_vars/all/letsencrypt_nginx_staging.yml

0
inventory/group_vars/all/production_domain.yml → inventories/common/group_vars/all/production_domain.yml

0
inventory/host_vars/chat-host/chat.yml → inventories/common/host_vars/chat-host/chat.yml

0
inventory/host_vars/external-host/disable-monitoring.yml → inventories/common/host_vars/external-host/disable-monitoring.yml

0
inventory/host_vars/forum-host/forum.yml → inventories/common/host_vars/forum-host/forum.yml

0
inventory/host_vars/gitlab-host/gitlab.yml → inventories/common/host_vars/gitlab-host/gitlab.yml

0
inventory/host_vars/icinga-host/monitoring.yml → inventories/common/host_vars/icinga-host/monitoring.yml

0
inventory/host_vars/packages-host/packages.yml → inventories/common/host_vars/packages-host/packages.yml

0
inventory/host_vars/weblate-host/weblate.yml → inventories/common/host_vars/weblate-host/weblate.yml

0
inventory/host_vars/website-host/website.yml → inventories/common/host_vars/website-host/website.yml

4
molecule/authorized_keys/molecule.yml

@ -14,8 +14,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: authorized_keys
test_sequence:

4
molecule/backup/molecule.yml

@ -18,8 +18,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: backup
test_sequence:

4
molecule/bind/molecule.yml

@ -20,8 +20,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../authorized_keys/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../icinga/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: bind
test_sequence:

2
molecule/certs/molecule.yml

@ -17,7 +17,7 @@ provisioner:
inventory:
links:
group_vars: certs_group_vars
host_vars: ../../inventory/host_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: certs
test_sequence:

4
molecule/chat/molecule.yml

@ -18,8 +18,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: chat
test_sequence:

4
molecule/cloud/molecule.yml

@ -25,8 +25,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../enough/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: cloud
test_sequence:

4
molecule/enough/molecule.yml

@ -25,8 +25,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: enough
test_sequence:

4
molecule/forum/molecule.yml

@ -21,8 +21,8 @@ provisioner:
inventory:
links:
# Path is relative to directory in which this molecule.yml file resides
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: forum
test_sequence:

4
molecule/gitlab/molecule.yml

@ -22,8 +22,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: gitlab
test_sequence:

2
molecule/gitlab/tests/gitlab_utils.py

@ -5,7 +5,7 @@ import yaml
def get_address(host):
vars_dir = '../../inventory/group_vars/all'
vars_dir = '../../inventories/common/group_vars/all'
return ('https', 'lab.' + yaml.load(
open(vars_dir + '/domain.yml'))['domain'])

4
molecule/icinga/molecule.yml

@ -20,8 +20,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: icinga
test_sequence:

2
molecule/icinga/tests/test_icingaweb.py

@ -7,7 +7,7 @@ import yaml
testinfra_hosts = ['icinga-host']
def get_address():
vars_dir = '../../inventory/group_vars/all'
vars_dir = '../../inventories/common/group_vars/all'
return 'icinga.' + yaml.load(
open(vars_dir + '/domain.yml'))['domain']

2
molecule/icinga/tests/test_letsencrypt.py

@ -7,7 +7,7 @@ import yaml
testinfra_hosts = ['icinga-host']
def get_address():
vars_dir = '../../inventory/group_vars/all'
vars_dir = '../../inventories/common/group_vars/all'
return 'icinga.' + yaml.load(
open(vars_dir + '/domain.yml'))['domain']

6
molecule/infrastructure/create.yml

@ -53,7 +53,7 @@
copy:
content: |
domain: enough.community
dest: "../../inventory/group_vars/all/domain.yml"
dest: "../../inventories/common/group_vars/all/domain.yml"
- block:
@ -74,7 +74,7 @@
copy:
content: |
domain: {{ domain }}
dest: "../../inventory/group_vars/all/domain.yml"
dest: "../../inventories/common/group_vars/all/domain.yml"
when: hosts_updates['all']['hosts']['bind-host'] is defined and (letsencrypt_nginx_staging | default(false))
@ -88,4 +88,4 @@
- name: Dump hosts_conf
copy:
content: "{{ hosts_orig | combine(hosts_updates, recursive=True) | to_yaml }}"
dest: "../../inventory/01-hosts.yml"
dest: "../../inventories/common/01-hosts.yml"

4
molecule/infrastructure/molecule.yml

@ -19,8 +19,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: infrastructure
test_sequence:

4
molecule/jdauphant.nginx/molecule.yml

@ -14,8 +14,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: jdauphant.nginx
test_sequence:

4
molecule/letsencrypt-nginx/molecule.yml

@ -22,8 +22,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../bind/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: letsencrypt-nginx
test_sequence:

4
molecule/misc/molecule.yml

@ -14,8 +14,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: misc
test_sequence:

4
molecule/packages/molecule.yml

@ -18,8 +18,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../bind/roles:../icinga/roles:../letsencrypt-nginx/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: packages
test_sequence:

4
molecule/postfix/molecule.yml

@ -20,8 +20,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: postfix
test_sequence:

4
molecule/preprod/molecule.yml

@ -48,8 +48,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: preprod
test_sequence:

4
molecule/weblate/molecule.yml

@ -20,8 +20,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: weblate
test_sequence:

2
molecule/weblate/tests/test_weblate.py

@ -5,7 +5,7 @@ import pytest
import yaml
def get_address():
vars_dir = '../../inventory/group_vars/all'
vars_dir = '../../inventories/common/group_vars/all'
return 'https://weblate.' + yaml.load(
open(vars_dir + '/domain.yml'))['domain']

4
molecule/website/molecule.yml

@ -18,8 +18,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: website
test_sequence:

4
molecule/wereport/molecule.yml

@ -25,8 +25,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../enough/roles
inventory:
links:
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
scenario:
name: wereport
test_sequence:

Loading…
Cancel
Save