summaryrefslogtreecommitdiffstats
path: root/roles/openshift_ansible_inventory
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_ansible_inventory')
-rw-r--r--roles/openshift_ansible_inventory/tasks/main.yml26
-rw-r--r--roles/openshift_ansible_inventory/templates/multi_ec2.yaml.j226
2 files changed, 15 insertions, 37 deletions
diff --git a/roles/openshift_ansible_inventory/tasks/main.yml b/roles/openshift_ansible_inventory/tasks/main.yml
index 5fe77e38b..05c7a5f93 100644
--- a/roles/openshift_ansible_inventory/tasks/main.yml
+++ b/roles/openshift_ansible_inventory/tasks/main.yml
@@ -1,11 +1,15 @@
---
-- yum:
- name: openshift-ansible-inventory
- state: present
+- action: "{{ ansible_pkg_mgr }} name={{ item}} state=present"
+ with_items:
+ - openshift-ansible-inventory
+ - openshift-ansible-inventory-aws
+ - openshift-ansible-inventory-gce
+ when: not openshift.common.is_containerized | bool
-- template:
- src: multi_ec2.yaml.j2
- dest: /etc/ansible/multi_ec2.yaml
+- name:
+ copy:
+ content: "{{ oo_inventory_accounts | to_nice_yaml }}"
+ dest: /etc/ansible/multi_inventory.yaml
group: "{{ oo_inventory_group }}"
owner: "{{ oo_inventory_owner }}"
mode: "0640"
@@ -19,17 +23,17 @@
- file:
state: link
- src: /usr/share/ansible/inventory/multi_ec2.py
- dest: /etc/ansible/inventory/multi_ec2.py
+ src: /usr/share/ansible/inventory/multi_inventory.py
+ dest: /etc/ansible/inventory/multi_inventory.py
owner: root
group: libra_ops
# This cron uses the above location to call its job
- name: Cron to keep cache fresh
cron:
- name: 'multi_ec2_inventory'
+ name: 'multi_inventory'
minute: '*/10'
- job: '/usr/share/ansible/inventory/multi_ec2.py --refresh-cache &> /dev/null'
+ job: '/usr/share/ansible/inventory/multi_inventory.py --refresh-cache &> /dev/null'
when: oo_cron_refresh_cache is defined and oo_cron_refresh_cache
- name: Set cache location
@@ -39,5 +43,5 @@
owner: root
group: libra_ops
recurse: yes
- mode: '2750'
+ mode: '2770'
when: oo_inventory_cache_location is defined
diff --git a/roles/openshift_ansible_inventory/templates/multi_ec2.yaml.j2 b/roles/openshift_ansible_inventory/templates/multi_ec2.yaml.j2
deleted file mode 100644
index 8228ab915..000000000
--- a/roles/openshift_ansible_inventory/templates/multi_ec2.yaml.j2
+++ /dev/null
@@ -1,26 +0,0 @@
-# multi ec2 inventory configs
-cache_max_age: {{ oo_inventory_cache_max_age }}
-cache_location: {{ oo_inventory_cache_location | default('~/.ansible/tmp/multi_ec2_inventory.cache') }}
-accounts:
-{% for account in oo_inventory_accounts %}
- - name: {{ account.name }}
- provider: {{ account.provider }}
- provider_config:
-{% for section, items in account.provider_config.items() %}
- {{ section }}:
-{% for property, value in items.items() %}
- {{ property }}: {{ value }}
-{% endfor %}
-{% endfor %}
- env_vars:
- AWS_ACCESS_KEY_ID: {{ account.env_vars.AWS_ACCESS_KEY_ID }}
- AWS_SECRET_ACCESS_KEY: {{ account.env_vars.AWS_SECRET_ACCESS_KEY }}
-{% if account.all_group is defined and account.hostvars is defined%}
- all_group: {{ account.all_group }}
- hostvars:
-{% for property, value in account.hostvars.items() %}
- {{ property }}: {{ value }}
-{% endfor %}
-{% endif %}
-
-{% endfor %}