From 0183d6b307f4b7fb35b72e365f7d27d7304ac267 Mon Sep 17 00:00:00 2001 From: hybris Date: Mon, 4 Feb 2019 13:22:51 +0100 Subject: [PATCH] Restructure roles --- 1-terraform.yml | 5 ++++- roles/dns/tasks/main.yml | 4 ++-- roles/dns/{files => templates}/resolv.conf.j2 | 0 roles/proxy/tasks/main.yml | 4 +--- roles/terraform/tasks/main.yml | 8 ++++---- .../{files => templates}/cloud-init-network.cfg.j2 | 0 roles/terraform/{files => templates}/cloud-init.cfg.j2 | 0 roles/terraform/{files => templates}/cloud-init.tf.j2 | 0 .../terraform/{files => templates}/libvirt_provider.tf.j2 | 0 9 files changed, 11 insertions(+), 10 deletions(-) rename roles/dns/{files => templates}/resolv.conf.j2 (100%) rename roles/terraform/{files => templates}/cloud-init-network.cfg.j2 (100%) rename roles/terraform/{files => templates}/cloud-init.cfg.j2 (100%) rename roles/terraform/{files => templates}/cloud-init.tf.j2 (100%) rename roles/terraform/{files => templates}/libvirt_provider.tf.j2 (100%) diff --git a/1-terraform.yml b/1-terraform.yml index 83c6a83..c709246 100644 --- a/1-terraform.yml +++ b/1-terraform.yml @@ -1,9 +1,12 @@ --- - hosts: terraform-master.e2m remote_user: hybris + become: yes roles: - - terraform + - dns + - proxy + # - terraform vars: # TODO: import hosts from a specific host group of the inventory instead of listing them here again diff --git a/roles/dns/tasks/main.yml b/roles/dns/tasks/main.yml index a3c1f7a..b5c66e0 100644 --- a/roles/dns/tasks/main.yml +++ b/roles/dns/tasks/main.yml @@ -1,4 +1,4 @@ - name: copy dns configuration - copy: - src: ../files/resolv.conf + template: + src: resolv.conf.j2 dest: /etc/resolv.conf \ No newline at end of file diff --git a/roles/dns/files/resolv.conf.j2 b/roles/dns/templates/resolv.conf.j2 similarity index 100% rename from roles/dns/files/resolv.conf.j2 rename to roles/dns/templates/resolv.conf.j2 diff --git a/roles/proxy/tasks/main.yml b/roles/proxy/tasks/main.yml index f4d445b..5814838 100644 --- a/roles/proxy/tasks/main.yml +++ b/roles/proxy/tasks/main.yml @@ -1,5 +1,4 @@ --- - - name: set proxy for yum lineinfile: dest: /etc/yum.conf @@ -31,8 +30,7 @@ - { regexp: '^export\ http_proxy', line: 'export http_proxy=http://[2001:470:6d:22c::1]:3128' } - { regexp: '^export\ https_proxy', line: 'export https_proxy=http://[2001:470:6d:22c::1]:3128' } - { regexp: '^export\ ftp_proxy', line: 'export ftp_proxy=http://[2001:470:6d:22c::1]:3128' } - - { regexp: '^export\ no_proxy', line: 'export no_proxy=localhost,::1,' } - + - { regexp: '^export\ no_proxy', line: 'export no_proxy=localhost,::1,127.0.0.1' } - name: ensure proxy env file exists file: diff --git a/roles/terraform/tasks/main.yml b/roles/terraform/tasks/main.yml index 2c2675f..c3d7118 100644 --- a/roles/terraform/tasks/main.yml +++ b/roles/terraform/tasks/main.yml @@ -17,7 +17,7 @@ - name: create vm definitions template: - src: "../files/cloud-init.tf.j2" + src: "cloud-init.tf.j2" dest: "/home/{{ ansible_ssh_user }}/terraform/{{ item.hostname }}.tf" owner: "{{ ansible_ssh_user }}" group: "{{ ansible_ssh_user }}" @@ -25,7 +25,7 @@ - name: create cloud-init config template: - src: "../files/cloud-init.cfg.j2" + src: "cloud-init.cfg.j2" dest: "/home/{{ ansible_ssh_user }}/terraform/{{ item.hostname }}.cloud_init.cfg" owner: "{{ ansible_ssh_user }}" group: "{{ ansible_ssh_user }}" @@ -33,7 +33,7 @@ - name: create cloud-init network config template: - src: "../files/cloud-init-network.cfg.j2" + src: "cloud-init-network.cfg.j2" dest: "/home/{{ ansible_ssh_user }}/terraform/{{ item.hostname }}.cloud_init_network.cfg" owner: "{{ ansible_ssh_user }}" group: "{{ ansible_ssh_user }}" @@ -41,7 +41,7 @@ - name: create libvirt_provider config template: - src: "../files/libvirt_provider.tf.j2" + src: "libvirt_provider.tf.j2" dest: "/home/{{ ansible_ssh_user }}/terraform/libvirt_provider.tf" owner: "{{ ansible_ssh_user }}" group: "{{ ansible_ssh_user }}" diff --git a/roles/terraform/files/cloud-init-network.cfg.j2 b/roles/terraform/templates/cloud-init-network.cfg.j2 similarity index 100% rename from roles/terraform/files/cloud-init-network.cfg.j2 rename to roles/terraform/templates/cloud-init-network.cfg.j2 diff --git a/roles/terraform/files/cloud-init.cfg.j2 b/roles/terraform/templates/cloud-init.cfg.j2 similarity index 100% rename from roles/terraform/files/cloud-init.cfg.j2 rename to roles/terraform/templates/cloud-init.cfg.j2 diff --git a/roles/terraform/files/cloud-init.tf.j2 b/roles/terraform/templates/cloud-init.tf.j2 similarity index 100% rename from roles/terraform/files/cloud-init.tf.j2 rename to roles/terraform/templates/cloud-init.tf.j2 diff --git a/roles/terraform/files/libvirt_provider.tf.j2 b/roles/terraform/templates/libvirt_provider.tf.j2 similarity index 100% rename from roles/terraform/files/libvirt_provider.tf.j2 rename to roles/terraform/templates/libvirt_provider.tf.j2