From 4c4737a6d1e9ac7fe762c0b28b0a805a46c9baa9 Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Sun, 2 Jun 2024 11:12:12 -0700 Subject: [PATCH] added vault passwords for the become pass. --- ansible.cfg | 1 + inventory/hosts.yaml | 7 +++++++ inventory/vaulted_vars.yaml | 6 ++++++ playbooks/apt_qol.yaml | 3 +++ playbooks/apt_update.yaml | 2 ++ playbooks/apt_upgrade.yaml | 2 ++ playbooks/starship.yaml | 2 ++ roles/starship/files/starship.toml | 4 ++-- 8 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 inventory/vaulted_vars.yaml diff --git a/ansible.cfg b/ansible.cfg index 1ef7bc0..6993896 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -74,6 +74,7 @@ # (boolean) This controls whether an Ansible playbook should prompt for a vault password. ;ask_vault_pass=False +ask_vault_pass=True # (pathspec) Colon separated paths in which Ansible will search for Cache Plugins. ;cache_plugins=/home/lkraven/.ansible/plugins/cache:/usr/share/ansible/plugins/cache diff --git a/inventory/hosts.yaml b/inventory/hosts.yaml index 4939d12..23130c7 100644 --- a/inventory/hosts.yaml +++ b/inventory/hosts.yaml @@ -1,16 +1,23 @@ docker: hosts: 10.250.50.70: + ansible_become_pass: '{{ std_become_pass }}' 10.0.50.45: + ansible_become_pass: '{{ std_become_pass }}' 10.100.50.40: + ansible_become_pass: '{{ std_become_pass }}' db: hosts: 10.0.50.60: + ansible_become_pass: '{{ std_become_pass }}' 10.250.50.81: + ansible_become_pass: '{{ std_become_pass }}' 10.250.50.80: + ansible_become_pass: '{{ std_become_pass }}' local: hosts: 127.0.0.1: + ansible_become_pass: '{{ std_become_pass }}' diff --git a/inventory/vaulted_vars.yaml b/inventory/vaulted_vars.yaml new file mode 100644 index 0000000..9200e5f --- /dev/null +++ b/inventory/vaulted_vars.yaml @@ -0,0 +1,6 @@ +$ANSIBLE_VAULT;1.1;AES256 +37616235663633663662623763323339356530363463636665343435653562333062663630376337 +3333626636376236323435373432323764633062353533300a393432613363393233636337323164 +31313638663464366663366637306262323833366339313538383430316464343238333639326637 +3730656461666539380a343664393266353731376439626539613862343339396363303739663834 +31393766323964633431303130616331353133613231306265393235323233343965 diff --git a/playbooks/apt_qol.yaml b/playbooks/apt_qol.yaml index 428854a..42319cd 100644 --- a/playbooks/apt_qol.yaml +++ b/playbooks/apt_qol.yaml @@ -1,4 +1,7 @@ +--- - hosts: "*" + vars_files: + - '~/ansible/inventory/vaulted_vars.yaml' become: yes tasks: - name: Install user default applications. tmux, vim-nox, btop, htop, neofetch diff --git a/playbooks/apt_update.yaml b/playbooks/apt_update.yaml index c58fcdf..c2716f9 100644 --- a/playbooks/apt_update.yaml +++ b/playbooks/apt_update.yaml @@ -1,4 +1,6 @@ - hosts: "*" + vars_files: + - '~/ansible/inventory/vaulted_vars.yaml' become: yes tasks: - name: apt diff --git a/playbooks/apt_upgrade.yaml b/playbooks/apt_upgrade.yaml index 7157d6f..d5834f4 100644 --- a/playbooks/apt_upgrade.yaml +++ b/playbooks/apt_upgrade.yaml @@ -1,4 +1,6 @@ - hosts: "*" + vars_files: + - '~/ansible/inventory/vaulted_vars.yaml' become: yes tasks: - name: apt diff --git a/playbooks/starship.yaml b/playbooks/starship.yaml index e256d37..c530fb4 100644 --- a/playbooks/starship.yaml +++ b/playbooks/starship.yaml @@ -1,3 +1,5 @@ - hosts: "all" + vars_files: + - '~/ansible/inventory/vaulted_vars.yaml' roles: - starship diff --git a/roles/starship/files/starship.toml b/roles/starship/files/starship.toml index b5b6d16..19d6979 100644 --- a/roles/starship/files/starship.toml +++ b/roles/starship/files/starship.toml @@ -24,8 +24,8 @@ format = '[$time ]($style)' style = "bold black" [fill] -symbol="_" -style = "bold black underline" +symbol="─" +style = "bold black" [hostname]