Using Ansible to Manage install and update Apple OSX DHCP clients
-
@black3dynamite didn't fix it.
-
So I know this will likely light a flame for someone, but when in the hell is yaml so annoying?
@IRJ how do I check my yaml configuration using the software you recommended, both VSCode and the extension are installed - just not sure how the heck to use yet.
-
Okay so in using the test.yaml file buried within the geerlingguy folder I was able to at least get some progress.
ansible-playbook -i hosts apple.yml PLAY [x.x.x.143] *********************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************** ok: [x.x.x.143] PLAY RECAP ********************************************************************************************************************************************************************************************************************************** x.x.x.143 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
But doesn't seem to install based on what's in the apple.yml file
--- - hosts: 1x.x.x.143 vars: homebrew_clear_cache: true homebrew_installed_packages: - ssh-copy-id # from homebrew/core - nginx-full # from dengi/nginx homebrew_cask_apps: - 1Password # from hombrew/cask
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Okay so in using the test.yaml file buried within the geerlingguy folder I was able to at least get some progress.
ansible-playbook -i hosts apple.yml
PLAY [x.x.x.143] ***********************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
ok: [x.x.x.143]PLAY RECAP **********************************************************************************************************************************************************************************************************************************
x.x.x.143 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0But doesn't seem to install based on what's in the apple.yml file
- hosts: 1x.x.x.143
vars:
homebrew_clear_cache: true
homebrew_installed_packages:
- ssh-copy-id # from homebrew/core
- nginx-full # from dengi/nginx
homebrew_cask_apps:
- 1Password # from hombrew/cask
Oh! I thought you were only using a single file.
Ok let's back up. can you show the folder structure of geerlingguy folder?
- hosts: 1x.x.x.143
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
So I know this will likely light a flame for someone, but when in the hell is yaml so annoying?
@IRJ how do I check my yaml configuration using the software you recommended, both VSCode and the extension are installed - just not sure how the heck to use yet.
It shows you when there is a formatting error
No error
Error. File lights up red and gives you a tip on how to fix.
-
@IRJ said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Okay so in using the test.yaml file buried within the geerlingguy folder I was able to at least get some progress.
ansible-playbook -i hosts apple.yml PLAY [x.x.x.143] *********************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ********************************************************************************************************************************************************************************************************************** ok: [x.x.x.143] PLAY RECAP ********************************************************************************************************************************************************************************************************************************** x.x.x.143 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
But doesn't seem to install based on what's in the apple.yml file
--- - hosts: 1x.x.x.143 vars: homebrew_clear_cache: true homebrew_installed_packages: - ssh-copy-id # from homebrew/core - nginx-full # from dengi/nginx homebrew_cask_apps: - 1Password # from hombrew/cask
Oh! I thought you were only using a single file.
Ok let's back up. can you show the folder structure of geerlingguy folder?
To summarize, everything is installed in the default locations.
tree /etc/ansible/ /etc/ansible/ ├── ansible.cfg ├── apple.yml ├── clients ├── hosts ├── requirements.yml ├── roles │ └── geerlingguy.homebrew │ ├── defaults │ │ └── main.yml │ ├── handlers │ │ └── main.yml │ ├── LICENSE │ ├── meta │ │ └── main.yml │ ├── README.md │ ├── requirements.yml │ ├── tasks │ │ ├── main.yml │ │ └── playbook.yml │ └── tests │ ├── local-testing │ │ ├── playbook.yml │ │ └── README.md │ └── test.yml └── ssh.sh 8 directories, 17 files
-
The clients file and ssh.sh are for a quick deployment of the ssh key to all of my workstations if this works out :-).
But ignore them for now.
-
This is the updated apply.yml file
--- - hosts: apple_workstations vars: homebrew_repo: https://github.com/Homebrew/brew homebrew_prefix: /usr/local homebrew_install_path: "{{ homebrew_prefix }}/Homebrew" homebrew_bin_path: /usr/local/bin homebrew_clear_cache: true homebrew_installed_packages: - ssh-copy-id # from homebrew/core - nginx-full # from dengi/nginx homebrew_cask_apps: - 1password homebrew_taps: - homebrew/cask - { name: denji/nginx, url: 'https://github.com/denji/homebrew-nginx.git' } homebrew_cask_accept_external_apps: true homebrew_cask_appdir: /Applications
It runs without issue, but doesn't actually install
1password
-
@IRJ said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Ok let's try this. Is your playbook only one file?
#*********************************************************** # Create or append ansible requirements file #*********************************************************** sudo sh -c "echo '- src: /etc/ansible/roles/geerlineguy' >> /etc/ansible/requirements.yml" #*********************************************************** # Install the role #*********************************************************** cd /etc/ansible/ sudo ansible-galaxy install -p roles -r /etc/ansible/requirements.yml #*********************************************************** # Run ansible playbook file #*********************************************************** sudo ansible-playbook /etc/ansible/apple.yml
Updated. try this
-
@IRJ Each command individually?
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@IRJ Each command individually?
yes reinstall the role this way
-
@IRJ So wouldn't I have to delete the role first?
-
Also this fails.
sudo ansible-galaxy install -p roles -r /etc/ansible/requirements.yml [WARNING]: - /etc/ansible/apple.yml was NOT installed successfully: the file downloaded was not a tar.gz ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@IRJ So wouldn't I have to delete the role first?
Just try running it first. If you delete the role, then the reference to source file will break.
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
Also this fails.
sudo ansible-galaxy install -p roles -r /etc/ansible/requirements.yml
[WARNING]: - /etc/ansible/apple.yml was NOT installed successfully: the file downloaded was not a tar.gzERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
let me see your
/etc/ansible/requirements.yml
-
cat /etc/ansible/requirements.yml - src: /etc/ansible/apple.yml - src: /etc/ansible/apple.yml - src: /etc/ansible/roles/geerlineguy
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
cat /etc/ansible/requirements.yml - src: /etc/ansible/apple.yml - src: /etc/ansible/apple.yml - src: /etc/ansible/roles/geerlineguy
get rid of the first two entries
-
@IRJ just did, not sure why they're in there as I haven't touched this file.
-
@DustinB3403 said in Using Ansible to Manage install and update Apple OSX DHCP clients:
@IRJ just did, not sure why they're in there as I haven't touched this file.
They are there because we did echo command in script to add them.
-
sudo ansible-galaxy install -p roles -r /etc/ansible/requirements.yml - downloading role '/etc/ansible/roles/geerlineguy', owned by [WARNING]: - /etc/ansible/roles/geerlineguy was NOT installed successfully: Content has no field named 'owner' ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.