Last active
April 25, 2018 05:00
-
-
Save AnneTheAgile/5e6666bd2e2c25890e1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# FILE: talk-battle-ansi-config | |
# README: Prepare a mac 10.9 machine for running battleschool by ensuring a config file/folder exists. | |
# USAGE: $ ansible-playbook -i ansinv ansiboot.yml # Where ansinv= Your inventory file; ansiboot.yml= This script. | |
# PREREQ: | |
# $ curl -L THIS-URL > ~/.battleschool/config.yml # TIP-Bash-Curl: L: If location redirects, go there instead. | |
# $ ansible all -m ping # Test that the inventory file exists and ansible works with local host. | |
# $ ansible workstation -m ping -i ansinv # Test that the given inventory file contains 'workstation'. | |
# NEXT: $ battle --ask-sudo-pass --config-file=/Users/YOURUSER/.battleschool/config.yml # Config is created by this script. | |
# []TODO- Ansible-Battle; IDK why Tilde is not accepted to find path for config file - especially given it defaults ok. | |
# URL: As of 2014-08-23S. | |
# https://gist.githubusercontent.com/AnneTheAgile/5e6666bd2e2c25890e1e/raw/a166f7ed2a27ea71cdca806dcab$ | |
# https://gist.github.com/AnneTheAgile/5e6666bd2e2c25890e1e | |
# FUTURE: []TODO- Add Bash wrapper to get this URL content and run the [usage] step. This is how brew.sh's one-liner works. | |
- hosts: workstation | |
vars: | |
SSHPWD: "{{ lookup('env','MY_PWD') }}" | |
# TIP-Bash-Env: Put Secret passwords (use LastPass) in environment variables, ~/.bashrc. $ export MY_PWD="aSecret" | |
# TODO-SSH: This section is for creating SSH keys during bootstrap-2. | |
tasks: | |
- name: "BattleSchool: Create Hidden Dot Folder for config files - ~/.battleschool/." | |
file: path=~/.battleschool state=directory | |
# TODO-Ansible: IDK when to / not use shell vs command module. Bash flavor may matter. | |
# TIP-Ansible-Yml: Colon in Name cannot be unquoted. | |
- name: "BattleSchool: Create Empty Configuration file for bootstrap initialization - ~/.battleschool/config.yml." | |
get_url: url=https://gist.githubusercontent.com/AnneTheAgile/071ce60cc5205b133db4/raw/3a5b9f3848c00ede0aa8aa1a435ba1eccf7888fc/talk-battle-config-empty.yml | |
dest=~/.battleschool/config.yml | |
# TIP-Battle: Original author's config.yml includes numerous things; https://db.tt/aG2uyydU | |
# TIP-Ansible: Use only get_url, not curl nor git module for gist text files. | |
- name: "BattleSchool: Apply correct permissions to config file - ~/.battleschool/config.yml." | |
file: path=~/.battleschool/config.yml state=file mode=755 | |
# TIP-Bash: chmod = 751 => owner=rwx, all others=rx. | |
# TIP-Battle: Config file must be readable and executable. => Updt; Maybe X-only is ok without Tilde. | |
# TIP-Bash: Chmod's numeric equivalents of text directives. URL: http://www.onlineconversion.com/html_chmod_calculator.htm |
BUG? Do need Sudo prefix.
$ ansible-playbook -vv -i ~/ansinv -M /usr/share/battleschool/library/ ~/.battleschool/playbooks/adium.yml
PLAY [workstation] ************************************************************
GATHERING FACTS ***************************************************************
<localhost> REMOTE_MODULE setup
ok: [localhost]
TASK: [say-tof] ***************************************************************
ok: [localhost] => {
"msg": "~HOME/.battleschool/playbooks/Adium.yml= Starting!"
}
TASK: [install Firefox] *******************************************************
<localhost> REMOTE_MODULE mac_pkg pkg_type=app url=http://sourceforge.net/projects/adium/files/Adium_1.5.9.dmg/download archive_type=dmg archive_path=Adium.app
failed: [localhost] => {"failed": true, "parsed": false}
[sudo via ansible, key=bzhjymtqnhzygnqgteaneeyeesiqwbfg] password:
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/HOME/adium.retry
localhost : ok=2 changed=0 unreachable=0 failed=1
TODO; Why firefox doesn't fit the model?
https://github.com/spencergibb/battleschool/blob/master/share/library/mac_pkg
https://github.com/spencergibb/ansible-osx/blob/master/adium.yml
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1.[] Modules don't need Paths, shouldn't need them.
https://groups.google.com/forum/#!topic/ansible-project/i_BFBfeZ4Ys
2.[] Nice Example , clearly shows all needed folder structures ; Tells Years of each Config mgmt tool intro inc. Juju.
http://tomoconnor.eu/blogish/getting-started-ansible/#.VDCPOlZ0UfE
3.[] Might need Recursive Sub-Git ; IDK WHY; might have been by mistake I did that.
http://docs.ansible.com/developing_modules.html#testing-modules
4.[] Running play books, another ex. Ubuntu.
https://www.digitalocean.com/community/tutorials/how-to-create-ansible-playbooks-to-automate-system-configuration-on-ubuntu