summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorSamuli Silvius <s.silvius@partner.samsung.com>2019-02-12 21:08:26 +0200
committerSamuli Silvius <s.silvius@partner.samsung.com>2019-03-03 14:16:31 +0200
commit79bfeda971b869869964f5d8191d191a3aaa4d73 (patch)
tree1fb69148aa99e3d80fd1b065757ef0ba289fd73c /ansible/roles
parent3313c854585836ec97b72e2ff82d9ed4bf4ed710 (diff)
package-repository role to streamline playbook
Create own role for repository handling to move functionality to roles from playbooks. This will make roles easier to test and make it easier to implement other OS support later. Issue-ID: OOM-1649 Change-Id: Ie8d25f83c54ec9f5a50fc6376a1ba7e166f07132 Signed-off-by: Samuli Silvius <s.silvius@partner.samsung.com>
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/package-repository/defaults/main.yml2
-rw-r--r--ansible/roles/package-repository/tasks/main.yml19
2 files changed, 21 insertions, 0 deletions
diff --git a/ansible/roles/package-repository/defaults/main.yml b/ansible/roles/package-repository/defaults/main.yml
new file mode 100644
index 00000000..ea5796df
--- /dev/null
+++ b/ansible/roles/package-repository/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+deploy_package_repository: true
diff --git a/ansible/roles/package-repository/tasks/main.yml b/ansible/roles/package-repository/tasks/main.yml
new file mode 100644
index 00000000..686310e4
--- /dev/null
+++ b/ansible/roles/package-repository/tasks/main.yml
@@ -0,0 +1,19 @@
+---
+- name: Setup resolv.conf for node to find package repository by name from infra
+ lineinfile:
+ line: "nameserver {{ hostvars[groups.infrastructure[0]].cluster_ip }}"
+ path: /etc/resolv.conf
+ state: present
+ insertbefore: BOF
+ become: true
+
+- name: Add application offline package repository
+ yum_repository:
+ name: "{{ app_name }}"
+ file: "{{ app_name | lower }}"
+ description: "{{ app_name | upper }} offline repository"
+ baseurl: "{{ 'http://repo.infra-server/rhel' if 'infrastructure' not in group_names else 'file://' + app_data_path + '/pkg/rhel' }}"
+ gpgcheck: false
+ enabled: true
+ when: deploy_package_repository
+ become: true