Commit 508178f7 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+7 −0
Changes for Introduction to Ansible - Working Files/Chapter 1/No Work Files.rtf: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 No work files for this lesson...}
 No newline at end of file
+19 −0
Changes for Introduction to Ansible - Working Files/Chapter 2/hosts: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
#Making a comment in my hosts file

rainbows.unicorns.com 

[testServer]
52.36.167.137 ansible_user=ec2-user ansible_ssh_user=ec2-user 
test1.example.com:5555

[testServer:vars]
ansible_user=ec2-user 

[webServers]
apache[01:50].example.com
nginx[50:100].example.com

[appServers]
app[a:f].example.com 

+19 −0
Changes for Introduction to Ansible - Working Files/Chapter 3/blocks.yml: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
---
- name: testing blocks
  hosts: testServer
  remote_user: ec2-user
  become: yes

  tasks:
    - block:
       - name: copying in a block
         copy: src=/tmp/test1.txt dest=/tmp/loops
      rescue:
       - debug: msg="Stop. Error time."
      always:
       - debug: msg="This message will always display."

    - block:
       - block:
          - block:
             - debug: msg="nesting some blocks"
 No newline at end of file
+39 −0
Changes for Introduction to Ansible - Working Files/Chapter 3/conditionals.yml: 39 added lines, 0 removed lines.
Original line number Diff line number Diff line
---
- name: testing conditionals
  hosts: testServer
  remote_user: ec2-user
  become: yes

  vars:
    unicorn: true

  tasks:
  - name: don't install on debian machines
    yum: name=httpd state=latest
    when: (ansible_os_family=="RedHat" and ansible_distribution_major_version=="6")

  - name: are unicorns real or fake
    shell: echo "unicorns are fake"
    when: not unicorn 

 # - fail: msg="unicorns require rainbow variable to be set"
 #   when: rainbow is undefined

  - name: test to see if selinux is running
    shell: getenforce
    register: sestatus

  - name: configure selinux if not enforcing
    seboolean: name=mysql_connect_any state=true persistent=yes
    when: sestatus.rc != 0

  - name: checking systemd
    shell: cat /var/log/messages
    register: log_output

  - name: next task
    shell: echo "systemd knows when we're doing ansible stuff"
    when: log_output.stdout.find('ansible') != 0
    register: shell_echo

  - debug: var=shell_echo  
 No newline at end of file
+32 −0
Changes for Introduction to Ansible - Working Files/Chapter 3/filters.yml: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
---
- name: testing filter options
  hosts: "{{database_host | default('testServer')}}"
  remote_user: ec2-user
  become: yes

  vars:
    cheese: ['american', 'cheddar', 'cheddar', 'mozzarella', 'bleu', 'manchego', 'mozzarella', 'brie']
    pizza_toppings: ['mozzarella', 'anchovies', 'pineapple', 'bleu', 'pepperoni', 'mushrooms', 'ham']
  
  tasks:
  - name: quick echo
    shell: echo $PATH
    register: result

  - debug: msg="The play failed"
    when: result|failed

  - debug: msg="The play changed"
    when: result|changed

  - debug: msg="The play succeeded"
    when: result|success

  - debug: msg="The play skipped"
    when: result|skipped

  - debug: msg="{{cheese | unique}}"

  - debug: msg="{{cheese | difference(pizza_toppings)}}"

  - debug: msg="{{cheese | union(pizza_toppings)}}"
 No newline at end of file
Loading