Skip to content

Commit

Permalink
[WIP] Get rid of workdir
Browse files Browse the repository at this point in the history
More /opt/workshop changes

Mass remove vars_files, pray for us

Added more ANSIBLE_REPO_PATH to be removed

Co-authored-by: Prakhar Srivastava <[email protected]>
  • Loading branch information
2 people authored and fridim committed Dec 3, 2018
1 parent dcf5885 commit efe8d4e
Show file tree
Hide file tree
Showing 564 changed files with 2,672 additions and 2,755 deletions.
9 changes: 0 additions & 9 deletions ansible/ansible.cfg

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion ansible/cloud_providers/azure_destroy_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
AZURE_CONFIG_DIR: "/tmp/.azure-{{project_tag}}"
block:
- set_fact:
t_dest: "{{ANSIBLE_REPO_PATH}}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"
t_dest: "{{workdir_dir}}/{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"

- name: Get all resources from the deployment
command: az group deployment show --name {{env_type}}.{{guid}} --resource-group {{az_resource_group}}
Expand Down
10 changes: 5 additions & 5 deletions ansible/cloud_providers/azure_infrastructure_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
- must

- set_fact:
t_dest: "{{ANSIBLE_REPO_PATH}}/workdir/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"
params_dest: "{{ANSIBLE_REPO_PATH}}/workdir/{{project_tag}}-cloud_template_parameters.json"
t_dest: "{{workdir_dir}}/{{ env_type }}.{{ guid }}.{{cloud_provider}}_cloud_template"
params_dest: "{{workdir_dir}}/{{project_tag}}-cloud_template_parameters.json"
tags:
- azure_infrastructure_deployment
- validate_azure_template
- gen_azure_template

- name: Azure Generate Resource manager template
template:
src: "{{ANSIBLE_REPO_PATH}}/configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template.j2"
src: "{{ANSIBLE_REPO_PATH | default('.')}}/configs/{{ env_type }}/files/cloud_providers/{{cloud_provider}}_cloud_template.j2"
dest: "{{t_dest}}"
tags:
- azure_infrastructure_deployment
Expand Down Expand Up @@ -256,7 +256,7 @@
verbosity: 2

- name: Configure local ssh config for bastion proxy use
import_playbook: "{{ANSIBLE_REPO_PATH}}/cloud_providers/{{cloud_provider}}_ssh_config_setup.yml"
import_playbook: "{{ANSIBLE_REPO_PATH | default('.')}}/cloud_providers/{{cloud_provider}}_ssh_config_setup.yml"
when: groups['bastions']
tags:
- must
Expand Down Expand Up @@ -392,7 +392,7 @@
block:
- name: Map Azure disks using LUN.
include_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-azure-disk-map"
name: "infra-azure-disk-map"
vars:
disk_map_device:
name: "{{ item.name }}"
Expand Down
2 changes: 1 addition & 1 deletion ansible/cloud_providers/azure_ssh_config_setup.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- name: Configure local ssh config for bastion proxy use
import_playbook: "{{ANSIBLE_REPO_PATH}}/cloud_providers/common_ssh_config_setup.yml"
import_playbook: "{{ANSIBLE_REPO_PATH | default('.')}}/cloud_providers/common_ssh_config_setup.yml"
4 changes: 2 additions & 2 deletions ansible/cloud_providers/common_ssh_config_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
bastion_hostname: "{{groups['bastions'].0 }}"
# This is where the ssh_config file will be created, this file is used to
# define the communication method to all the hosts in the deployment
ansible_ssh_config: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf"
ansible_known_host: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_known_hosts"
ansible_ssh_config: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf"
ansible_known_host: "{{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_known_hosts"

- name: Delete dedicated known_host if it exists (new deployment)
file:
Expand Down
18 changes: 9 additions & 9 deletions ansible/cloud_providers/ec2_infrastructure_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
tasks:
- name: Run infra-ec2-template-generate Role
import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-template-generate"
name: infra-ec2-template-generate

- name: Run infra-ec2-template-create Role
import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-template-create"
name: "infra-ec2-template-create"
vars:
aws_region_loop: "{{aws_region}}"

- name: Run infra-ec2-template-create Role into FallBack region
include_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-template-create"
name: "infra-ec2-template-create"
vars:
aws_region_loop: "{{item}}"
with_items: "{{ fallback_regions }}"
Expand Down Expand Up @@ -56,10 +56,10 @@

- name: Run infra-ec2-create-inventory Role
import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-create-inventory"
name: "infra-ec2-create-inventory"
- name: Run Common SSH Config Generator Role
import_role:
name: "{{ANSIBLE_REPO_PATH}}/roles/infra-common-ssh-config-generate"
name: "infra-common-ssh-config-generate"

# include global vars again, this time for all hosts now that the inventory is built
- import_playbook: ../include_vars.yml
Expand All @@ -82,14 +82,14 @@
- create_inventory
set_fact:
aws_region_final: "{{hostvars['localhost'].aws_region_final}}"
ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{ guid }}_ssh_conf"
ansible_ssh_extra_args: "{{ ansible_ssh_extra_args|d() }} -F {{workdir_dir}}/{{ env_type }}_{{ guid }}_ssh_conf"

- name: Run infra-ec2-wait_for_linux_hosts Role
import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-wait_for_linux_hosts"
name: "infra-ec2-wait_for_linux_hosts"
- name: Run infra-ec2-linux-set-hostname Role
import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-linux-set-hostname"
name: "infra-ec2-linux-set-hostname"



Expand Down Expand Up @@ -117,4 +117,4 @@

- name: Run infra-ec2-wait_for_linux_hosts Role
import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/infra-ec2-wait_for_windows_hosts"
name: "infra-ec2-wait_for_windows_hosts"
2 changes: 1 addition & 1 deletion ansible/cloud_providers/ec2_ssh_config_setup.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
- name: Configure local ssh config for bastion proxy use
import_playbook: "{{ANSIBLE_REPO_PATH}}/cloud_providers/common_ssh_config_setup.yml"
import_playbook: "./cloud_providers/common_ssh_config_setup.yml"
4 changes: 2 additions & 2 deletions ansible/configs/ans-tower-lab/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DEPLOYER_REPO_PATH=`pwd`
ansible-playbook \
${DEPLOYER_REPO_PATH}/main.yml \
-e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \
-e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \
-e "guid=${GUID}" \
-e "env_type=${ENVTYPE}" \
-e "key_name=${KEYNAME}" \
Expand Down Expand Up @@ -91,7 +91,7 @@ DEPLOYER_REPO_PATH=`pwd`
ansible-playbook \
${DEPLOYER_REPO_PATH}/main.yml \
-e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \
-e "ANSIBLE_REPO_PATH | default('.')=${DEPLOYER_REPO_PATH}" \
-e "guid=${GUID}" \
-e "env_type=${ENVTYPE}" \
-e "key_name=${KEYNAME}" \
Expand Down
6 changes: 3 additions & 3 deletions ansible/configs/ans-tower-lab/destroy_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
connection: local
gather_facts: False
become: no
vars_files:
- "./env_vars.yml"
- "./env_secret_vars.yml"




tasks:
- name: Destroy cloudformation template
Expand Down
6 changes: 3 additions & 3 deletions ansible/configs/ans-tower-lab/post_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
hosts: localhost
connection: local
become: false
vars_files:
- "./env_vars.yml"
- "./env_secret_vars.yml"



tags:
- step002
- post_infrastructure
Expand Down
40 changes: 20 additions & 20 deletions ansible/configs/ans-tower-lab/post_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
hosts: support
gather_facts: False
become: yes
vars_files:
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"


tasks:
- debug:
msg: "Post-Software tasks Started"
Expand All @@ -12,15 +12,15 @@
hosts:
- windows[0]
gather_facts: False
vars_files:
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"



tags:
- step004
- common_tasks
- windows_tasks
roles:
- { role: "{{ ANSIBLE_REPO_PATH }}/roles/windows-ad", when: install_win_ad | bool }
- { role: "windows-ad", when: install_win_ad | bool }
tasks:
- name: Reboot upon promotion
win_reboot:
Expand All @@ -36,14 +36,14 @@
become: yes
tags:
- opentlc_bastion_tasks
vars_files:
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"


tasks:
- import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/bastion-opentlc-ipa"
name: "bastion-opentlc-ipa"
when: install_ipa_client|bool
- import_role:
name: "{{ ANSIBLE_REPO_PATH }}/roles/ansible-version-lock"
name: "ansible-version-lock"

- name: Copy Tower License File
copy:
Expand All @@ -68,28 +68,28 @@
- name: Post Tower configs
hosts: towers[0]
become: yes
vars_files:
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"


roles:
- { role: "{{ ANSIBLE_REPO_PATH }}/roles/tower_demo", when: deploy_tower_demo | d(false) | bool }
- { role: "tower_demo", when: deploy_tower_demo | d(false) | bool }

- name: Install Tower For Homework
hosts: bastions
become: yes
vars_files:
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"



roles:
- { role: "{{ ANSIBLE_REPO_PATH }}/roles/install-tower", when: deploy_tower_homework | d(false) | bool }
- { role: "install-tower", when: deploy_tower_homework | d(false) | bool }

- name: PostSoftware flight-check
hosts: localhost
connection: local
gather_facts: false
become: false
vars_files:
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
- "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_secret_vars.yml"



tags:
- post_flight_check
tasks:
Expand Down
12 changes: 6 additions & 6 deletions ansible/configs/ans-tower-lab/pre_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
hosts: localhost
connection: local
become: false
vars_files:
- "./env_vars.yml"
- "./env_secret_vars.yml"



tags:
- step001
- pre_infrastructure
Expand All @@ -14,7 +14,7 @@
block:
- name: Stat workdir/[...]_windows_password.txt file
stat:
path: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{guid}}_windows_password.txt"
path: "{{workdir_dir}}/{{ env_type }}_{{guid}}_windows_password.txt"
register: passwordfile
# This task needs to be "ansibled", we cannot assume tr exists
# This also doesn't work on MAC, that does have tr.
Expand All @@ -24,7 +24,7 @@
when: not passwordfile.stat.exists

- name: Read windows password from workdir/[...]_windows_password.txt file
command: "cat '{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{guid}}_windows_password.txt'"
command: "cat '{{workdir_dir}}/{{ env_type }}_{{guid}}_windows_password.txt'"
register: password_get_r
changed_when: false
when: passwordfile.stat.exists
Expand All @@ -43,5 +43,5 @@
- name: Save windows_password or generated_windows_password into workdir/
copy:
content: "{{ windows_password | default(generated_windows_password) }}"
dest: "{{ ANSIBLE_REPO_PATH }}/workdir/{{ env_type }}_{{guid}}_windows_password.txt"
dest: "{{workdir_dir}}/{{ env_type }}_{{guid}}_windows_password.txt"
mode: 0600
Loading

0 comments on commit efe8d4e

Please sign in to comment.