Skip to content

Instantly share code, notes, and snippets.

@AnneTheAgile
Last active April 25, 2018 05:00
Show Gist options
  • Save AnneTheAgile/5e6666bd2e2c25890e1e to your computer and use it in GitHub Desktop.
Save AnneTheAgile/5e6666bd2e2c25890e1e to your computer and use it in GitHub Desktop.
---
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment