Browse Source

unify inventories/common and ~/.enough inventory dirname

keep-around/a4fc237fa086d3093b8dc2e953fb3e4b5504e211
singuliere 3 years ago
parent
commit
64eb8f1343
No known key found for this signature in database GPG Key ID: 900857755EF189C2
  1. 13
      docs/ansible.rst
  2. 2
      enough/common/hosting.py
  3. 0
      inventory/02-all.yml
  4. 0
      inventory/all.yml
  5. 0
      inventory/firewall.yml
  6. 0
      inventory/group_vars/all/config_directory.yml
  7. 0
      inventory/group_vars/all/letsencrypt_nginx_staging.yml
  8. 0
      inventory/group_vars/all/letsencrypt_staging.yml
  9. 0
      inventory/group_vars/all/private-key.yml
  10. 0
      inventory/group_vars/all/production_domain.yml
  11. 0
      inventory/group_vars/gitlab/gitlab.yml
  12. 0
      inventory/host_vars/api-host/api.yml
  13. 0
      inventory/host_vars/chat-host/chat.yml
  14. 0
      inventory/host_vars/external-host/disable-monitoring.yml
  15. 0
      inventory/host_vars/forum-host/forum.yml
  16. 0
      inventory/host_vars/gitlab-host/gitlab.yml
  17. 0
      inventory/host_vars/icinga-host/monitoring.yml
  18. 0
      inventory/host_vars/packages-host/packages.yml
  19. 0
      inventory/host_vars/weblate-host/weblate.yml
  20. 0
      inventory/host_vars/website-host/website.yml
  21. 6
      molecule/api/molecule.yml
  22. 2
      molecule/api/roles/api/tasks/api.yml
  23. 5
      molecule/api/tests/test_api.py
  24. 4
      molecule/authorized_keys/molecule.yml
  25. 6
      molecule/backup/molecule.yml
  26. 6
      molecule/bind/molecule.yml
  27. 6
      molecule/chat/molecule.yml
  28. 6
      molecule/cloud/molecule.yml
  29. 6
      molecule/enough/molecule.yml
  30. 4
      molecule/firewall/molecule.yml
  31. 6
      molecule/forum/molecule.yml
  32. 6
      molecule/gitlab/molecule.yml
  33. 4
      molecule/gitlab/tests/gitlab_utils.py
  34. 6
      molecule/icinga/molecule.yml
  35. 2
      molecule/icinga/tests/test_icingaweb.py
  36. 2
      molecule/icinga/tests/test_letsencrypt.py
  37. 6
      molecule/infrastructure/create.yml
  38. 4
      molecule/infrastructure/molecule.yml
  39. 6
      molecule/letsencrypt-nginx/molecule.yml
  40. 4
      molecule/letsencrypt/molecule.yml
  41. 4
      molecule/misc/molecule.yml
  42. 6
      molecule/packages/molecule.yml
  43. 6
      molecule/postfix/molecule.yml
  44. 6
      molecule/preprod/molecule.yml
  45. 6
      molecule/wazuh/molecule.yml
  46. 2
      molecule/wazuh/tests/test_wazuh.py
  47. 6
      molecule/weblate/molecule.yml
  48. 2
      molecule/weblate/tests/test_weblate.py
  49. 6
      molecule/website/molecule.yml
  50. 6
      molecule/wereport/molecule.yml
  51. 2
      setup.cfg
  52. 2
      tests/conftest.py
  53. 8
      tests/enough/common/test_openstack.py
  54. 2
      tests/icinga_helper.py

13
docs/ansible.rst

@ -8,10 +8,9 @@ The default credentials (for Weblate, Discourse etc.) are only
suitable for integration testing and must be overriden before
deploying on publicly available hosts. The recommended way of doing this is to:
* create a repository in `~/.enough/enough.community`
* for each files containing secrets in `inventories/common`
(i.e. {host,group}_vars/\*\*/\*.yml`) create a matching file in
`~/.enough/enough.community`
* create a repository in `~/.enough/enough.community/inventory`
* for each files containing secrets i.e. {host,group}_vars/\*\*/\*.yml`) create a matching file in
`~/.enough/enough.community/inventory`
* encrypt those files with `ansible vault <https://docs.ansible.com/ansible/latest/user_guide/vault.html>`_
* share the password to decrypt the files with trusted administrators
* push in a private repository
@ -22,7 +21,7 @@ publicly exposed to brute force attacks.
Creation
--------
Manually create `~/.enough/enough.community/group_vars/all/clouds.yml`
Manually create `~/.enough/enough.community/inventory/group_vars/all/clouds.yml`
by copying `clouds.yml.example` and getting values from `~/openrc.sh`
and check it works:
@ -96,7 +95,7 @@ The `ansible repository
$ ansible-playbook --private-key ~/.enough/enough.community/infrastructure_key \
--vault-password-file=~/.enough/enough.community/vault_pass.txt \
-i inventories/common \
-i ~/.enough/enough.community \
-i ~/.enough/enough.community/inventory \
enough-community-playbook.yml
Some hosts contain private information that belong to users who only
@ -114,5 +113,5 @@ them as follows:
--vault-password-file=~/.enough/enough.community/vault_pass.txt \
-i inventories/common \
-i inventories/dachary \
-i ~/.enough/enough.community \
-i ~/.enough/enough.community/inventory \
enough-community-playbook.yml

2
enough/common/hosting.py

@ -10,7 +10,7 @@ class Hosting(object):
self.name = name
self.domain = f"{name}.d.{settings.ENOUGH_DOMAIN}"
self.config_dir = os.path.expanduser(f'~/.enough/{self.domain}')
d = f'{self.config_dir}/group_vars/all'
d = f'{self.config_dir}/inventory/group_vars/all'
if not os.path.exists(d):
os.makedirs(d)
self.clouds_file = f'{d}/clouds.yml'

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

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

0
inventories/common/firewall.yml → inventory/firewall.yml

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

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

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

0
inventories/common/group_vars/all/private-key.yml → inventory/group_vars/all/private-key.yml

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

0
inventories/common/group_vars/gitlab/gitlab.yml → inventory/group_vars/gitlab/gitlab.yml

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

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

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

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

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

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

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

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

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

6
molecule/api/molecule.yml

@ -21,7 +21,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,packages-host,icinga-host,api-host,gitlab-host,localhost
lint:
name: ansible-lint
@ -29,8 +29,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../bind/roles:../packages/roles:../gitlab/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: api
test_sequence:

2
molecule/api/roles/api/tasks/api.yml

@ -101,7 +101,7 @@
vars:
clouds_files:
- "{{ api_config_directory }}/clouds.yml"
- "../../../../../inventories/common/group_vars/all/clouds.yml"
- "../../../../../inventory/group_vars/all/clouds.yml"
- name: enough manage enough_api
shell: |

5
molecule/api/tests/test_api.py

@ -13,7 +13,7 @@ testinfra_hosts = ['api-host']
def get_domain():
vars_dir = '../../inventories/common/group_vars/all'
vars_dir = '../../inventory/group_vars/all'
return yaml.load(open(vars_dir + '/domain.yml'))['domain']
@ -173,7 +173,8 @@ def test_create_or_upgrade(host):
assert str(resolver.query(f'ns-bar.d.{domain}.', 'a')[0])
r = s.delete(f'{url}/hosted/bar/', timeout=600)
with host.sudo():
content = host.file(f"/root/.enough/bar.d.{domain}/group_vars/all/clouds.yml").content
content = host.file(
f"/root/.enough/bar.d.{domain}/inventory/group_vars/all/clouds.yml").content
with tempfile.NamedTemporaryFile() as f:
f.write(content)
f.flush()

4
molecule/authorized_keys/molecule.yml

@ -14,8 +14,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: authorized_keys
test_sequence:

6
molecule/backup/molecule.yml

@ -13,7 +13,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml,../../inventories/common/02-all.yml
i: ../../inventory/firewall.yml,../../inventory/02-all.yml
limit: bind-host,weblate-host,localhost
lint:
name: ansible-lint
@ -21,8 +21,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../backup/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: backup
test_sequence:

6
molecule/bind/molecule.yml

@ -17,7 +17,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,bind-client-host,external-host,icinga-host,localhost
lint:
name: ansible-lint
@ -25,8 +25,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../authorized_keys/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../icinga/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: bind
test_sequence:

6
molecule/chat/molecule.yml

@ -13,7 +13,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,chat-host,icinga-host,localhost
lint:
name: ansible-lint
@ -21,8 +21,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: chat
test_sequence:

6
molecule/cloud/molecule.yml

@ -23,7 +23,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,cloud-host,localhost
lint:
name: ansible-lint
@ -31,8 +31,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../enough/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: cloud
test_sequence:

6
molecule/enough/molecule.yml

@ -22,7 +22,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,cloud-host,localhost
lint:
name: ansible-lint
@ -30,8 +30,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: enough
test_sequence:

4
molecule/firewall/molecule.yml

@ -32,8 +32,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: firewall
test_sequence:

6
molecule/forum/molecule.yml

@ -15,7 +15,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,forum-host,localhost
lint:
name: ansible-lint
@ -24,8 +24,8 @@ provisioner:
inventory:
links:
# Path is relative to directory in which this molecule.yml file resides
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: forum
test_sequence:

6
molecule/gitlab/molecule.yml

@ -19,7 +19,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,runner-host,gitlab-host,localhost
lint:
name: ansible-lint
@ -27,8 +27,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: gitlab
test_sequence:

4
molecule/gitlab/tests/gitlab_utils.py

@ -2,7 +2,7 @@ import yaml
def get_fqdn():
vars_dir = '../../inventories/common/group_vars/all'
vars_dir = '../../inventory/group_vars/all'
return 'lab.' + yaml.load(open(vars_dir + '/domain.yml'))['domain']
@ -12,5 +12,5 @@ def get_url():
def get_password():
variables = yaml.load(open(
'../../inventories/common/group_vars/gitlab/gitlab.yml'))
'../../inventory/group_vars/gitlab/gitlab.yml'))
return variables['gitlab_password']

6
molecule/icinga/molecule.yml

@ -19,7 +19,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,icinga-host,monitoring-client-host,monitoring-client2-host,localhost
lint:
name: ansible-lint
@ -27,8 +27,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: icinga
test_sequence:

2
molecule/icinga/tests/test_icingaweb.py

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

2
molecule/icinga/tests/test_letsencrypt.py

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

6
molecule/infrastructure/create.yml

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

4
molecule/infrastructure/molecule.yml

@ -19,8 +19,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: infrastructure
test_sequence:

6
molecule/letsencrypt-nginx/molecule.yml

@ -25,7 +25,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,nginx-host,proxy-host,client-host,localhost
# options:
# vvv: True
@ -35,8 +35,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../bind/roles:../letsencrypt/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: letsencrypt-nginx
test_sequence:

4
molecule/letsencrypt/molecule.yml

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

4
molecule/misc/molecule.yml

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

6
molecule/packages/molecule.yml

@ -13,7 +13,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,icinga-host,packages-host,localhost
lint:
name: ansible-lint
@ -21,8 +21,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../bind/roles:../icinga/roles:../letsencrypt-nginx/roles:../jdauphant.nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: packages
test_sequence:

6
molecule/postfix/molecule.yml

@ -13,7 +13,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,icinga-host,postfix-host,localhost
lint:
name: ansible-lint
@ -21,8 +21,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: postfix
test_sequence:

6
molecule/preprod/molecule.yml

@ -57,15 +57,15 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
lint:
name: ansible-lint
env:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../backup/roles:../misc/roles:../packages/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: preprod
test_sequence:

6
molecule/wazuh/molecule.yml

@ -17,7 +17,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,wazuh-host,localhost
lint:
name: ansible-lint
@ -25,8 +25,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: wazuh
test_sequence:

2
molecule/wazuh/tests/test_wazuh.py

@ -18,7 +18,7 @@ class Wazuh(object):
}
def get_address(self):
vars_dir = '../../inventories/common/group_vars/all'
vars_dir = '../../inventory/group_vars/all'
return 'wazuh.' + yaml.load(
open(vars_dir + '/domain.yml'))['domain']

6
molecule/weblate/molecule.yml

@ -15,7 +15,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,weblate-host,localhost
lint:
name: ansible-lint
@ -23,8 +23,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: weblate
test_sequence:

2
molecule/weblate/tests/test_weblate.py

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

6
molecule/website/molecule.yml

@ -13,7 +13,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,icinga-host,website-host,localhost
lint:
name: ansible-lint
@ -21,8 +21,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: website
test_sequence:

6
molecule/wereport/molecule.yml

@ -23,7 +23,7 @@ platforms:
provisioner:
name: ansible
options:
i: ../../inventories/common/firewall.yml
i: ../../inventory/firewall.yml
limit: bind-host,postfix-host,icinga-host,wereport-host,localhost
lint:
name: ansible-lint
@ -31,8 +31,8 @@ provisioner:
ANSIBLE_ROLES_PATH: roles:../infrastructure/roles:../firewall/roles:../postfix/roles:../bind/roles:../icinga/roles:../jdauphant.nginx/roles:../letsencrypt-nginx/roles:../enough/roles
inventory:
links:
group_vars: ../../inventories/common/group_vars
host_vars: ../../inventories/common/host_vars
group_vars: ../../inventory/group_vars
host_vars: ../../inventory/host_vars
scenario:
name: wereport
test_sequence:

2
setup.cfg

@ -38,7 +38,7 @@ packages =
data_files =
share/enough = ansible.cfg
share/enough/molecule = molecule/*
share/enough/inventories = inventories/*
share/enough/inventory = inventory/*
[entry_points]
console_scripts =

2
tests/conftest.py

@ -93,5 +93,5 @@ def openstack_name():
prefix = 'enough_test_' + str(int(time.time()))
yield prefix
logging.getLogger('sh').setLevel(logging.CRITICAL)
o = OpenStack('inventories/common/group_vars/all/clouds.yml')
o = OpenStack('inventory/group_vars/all/clouds.yml')
o.destroy_everything(prefix)

8
tests/enough/common/test_openstack.py

@ -23,7 +23,7 @@ def test_stack_create_or_update(openstack_name):
},
],
}
s = Stack('inventories/common/group_vars/all/clouds.yml', d)
s = Stack('inventory/group_vars/all/clouds.yml', d)
s.set_public_key('infrastructure_key.pub')
r = s.create_or_update()
assert r['port'] == '22'
@ -38,7 +38,7 @@ def test_stack_create_or_update(openstack_name):
@pytest.mark.skipif('SKIP_OPENSTACK_INTEGRATION_TESTS' in os.environ,
reason='skip integration test')
def test_heat_is_working(tmpdir):
o = OpenStack('inventories/common/group_vars/all/clouds.yml')
o = OpenStack('inventory/group_vars/all/clouds.yml')
assert o.generate_clouds(tmpdir)
heat_paths = []
for f in sorted(os.listdir(tmpdir)):
@ -65,14 +65,14 @@ def test_heat_definition():
@pytest.mark.skipif('SKIP_OPENSTACK_INTEGRATION_TESTS' in os.environ,
reason='skip integration test')
def test_region_list():
o = OpenStack('inventories/common/group_vars/all/clouds.yml')
o = OpenStack('inventory/group_vars/all/clouds.yml')
assert o.config['clouds']['ovh']['region_name'] in o.region_list()
@pytest.mark.skipif('SKIP_OPENSTACK_INTEGRATION_TESTS' in os.environ,
reason='skip integration test')
def test_region_empty(openstack_name):
clouds_file = 'inventories/common/group_vars/all/clouds.yml'
clouds_file = 'inventory/group_vars/all/clouds.yml'
if OpenStack.region_empty(clouds_file):
c = sh.openstack.bake('--os-cloud=ovh', _env={
'OS_CLIENT_CONFIG_FILE': clouds_file,

2
tests/icinga_helper.py

@ -25,7 +25,7 @@ class IcingaHelper(object):
)
def get_address(self):
vars_dir = '../../inventories/common/group_vars/all'
vars_dir = '../../inventory/group_vars/all'
return 'icinga.' + yaml.load(
open(vars_dir + '/domain.yml'))['domain']

Loading…
Cancel
Save