Ansible Notes: Difference between revisions
From Federal Burro of Information
Jump to navigationJump to search
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
or -o :P | or -o :P | ||
== | == Run Local== | ||
sudo ansible-playbook --connection=local --inventory 127.0.0.1, playbooks/playbook.yml -v | sudo ansible-playbook --connection=local --inventory 127.0.0.1, playbooks/playbook.yml -v | ||
Line 24: | Line 24: | ||
vi /etc/ansible/hosts | vi /etc/ansible/hosts | ||
== Cloud-init to make tags facts == | == Cloud-init to make AWS tags into facts == | ||
<pre> | <pre> |
Latest revision as of 21:56, 9 September 2022
output to one line:
cat /tmp/david/report.java | perl -n -e " $/ = '' ; print join ( ',' , split\"\n\" ) . \"\n\"; " | more
or -o :P
Run Local
sudo ansible-playbook --connection=local --inventory 127.0.0.1, playbooks/playbook.yml -v
Git install
under rhel6:
cd ~ mkdir work yum install gcc python-devel git clone https://github.com/ansible/ansible.git git submodule update --init --recursive make install mkdir /etc/ansible vi /etc/ansible/hosts
Cloud-init to make AWS tags into facts
- path: /etc/facter/facts.d/tags.sh permissions: 0755 content: | #!/usr/bin/env bash instanceId=`curl http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null` region=`curl http://169.254.169.254/latest/meta-data/placement/availability-zone 2>/dev/null | sed 's/[a-z]$//g'` /usr/bin/aws ec2 describe-tags --filters "Name=resource-id,Values=$instanceId" --region $region | jq '.Tags[] | "ec2_tag_" + .Key + "=" + .Value' | tr [:upper:] [:lower:] | tr -d '"' exit 0