Commit bb81f0c4 authored by Matej Madeja's avatar Matej Madeja
Browse files

playbooks intro

parents
[defaults]
inventory = ./hosts
\ No newline at end of file
[devices]
device1 ansible_port=11022 ansible_host=127.0.0.1 ansible_user=vagrant become_user=root
[locals]
localhost ansible_user=matt ansible_connection=local
\ No newline at end of file
```
ansible all -a "sudo /sbin/reboot"
ansible all -m command -a "/sbin/reboot" -a -b
ansible all -m shell -a "/sbin/reboot" -a -b
ansible all -m reboot -b
ansible all -m shell -a "hostname"
ansible all -m hostname -a "name=matejmadeja" -b
ansible all -m hostname -a "name=node5" -b
ansible all -m copy -a "src=/tmp/test.txt dest=/tmp/haluz.txt"
ansible all -m file -a "path=/tmp/test state=directory"
ansible all -m shell -a "mv /tmp/haluz.txt /tmp/test/haluz.txt"
ansible all -m file -a "path=/tmp/test state=absent"
ansible all -m apt -a "name=cmatrix state=present" -b
```
\ No newline at end of file
[defaults]
inventory = ./hosts
\ No newline at end of file
---
- name: "Install base pkg"
hosts:
- devices
become: yes
vars:
name: "Matej Madeja"
tasks:
- name: Use tamplate
template:
src: template.j2
dest: /tmp/output.txt
mode: '0644'
[devices]
device1 ansible_port=11022 ansible_host=127.0.0.1 ansible_user=vagrant
[locals]
localhost ansible_user=matt ansible_connection=local
\ No newline at end of file
all:
hosts:
device1:
ansible_port: 11022
fjsadlkfd
localhost:
ansible_user: matt
This is my name: {{ name }}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment