Python boto ?
AWS bucket?

 

Screen Shot 2017-04-24 at 20.12.21

-a – module arguments

-m – module

Screen Shot 2017-04-24 at 20.25.59.png

-i inventory name (ec2.py is a dynamic inventory script that retrieves all EC2 hosts from your amazon)

Screen Shot 2017-04-24 at 20.32.58.png

-u – user

Screen Shot 2017-04-24 at 20.48.55

s3- AWS module

Screen Shot 2017-04-24 at 21.06.28

 

force=yes – given file will be overwritten with new one

Screen Shot 2017-04-24 at 21.07.56

become
set to ‘true’/’yes’ to activate privilege escalation.
become_user
set to user with desired privileges — the user you ‘become’, NOT the user you login as. Does NOT imply become: yes, to allow it to be set at host level.
become_method
(at play or task level) overrides the default method set in ansible.cfg, set to sudo/su/pbrun/pfexec/doas/dzdo/ksu
become_flags
(at play or task level) permit to use specific flags for the tasks or role. One common use is to change user to nobody when the shell is set to no login. Added in Ansible 2.2.

 

 

APT state

Screen Shot 2017-04-25 at 12.00.24.png

 

SERVICES state

# Example action to start service httpd, if not running
- service:
    name: httpd
    state: started

# Example action to stop service httpd, if running
- service:
    name: httpd
    state: stopped

Screen Shot 2017-04-25 at 12.01.44.png

 

Screen Shot 2017-04-24 at 20.13.56.png

 

When we execute an ansible playbook by default it will gather facts of operating system first and then execute tasks listed in it.

Its always not required to gather facts & if we have too many hosts it will take more time to execute a playbook.

To mitigate this we need to disable gather facts with “gather_facts” attribute in ansible playbook.

By default gather_facts attributes value is True, to disable it we need to set it as False.

GCE: Google Cloud Engine module

 

Screen Shot 2017-04-24 at 20.46.34.png

S3 module

mode=put

Screen Shot 2017-04-25 at 12.26.55.png

 

COPY module

# Example from Ansible Playbooks


- copy:
    src: /srv/myfiles/foo.conf
    dest: /etc/foo.conf
    owner: foo
    group: foo
    mode: 0644

 

 

 

 

 

Advertisements