Skip to content

Instantly share code, notes, and snippets.

@kevsersrca
Last active October 4, 2021 09:59
Show Gist options
  • Save kevsersrca/d2e94dee5b2460365ae6c14af4617487 to your computer and use it in GitHub Desktop.
Save kevsersrca/d2e94dee5b2460365ae6c14af4617487 to your computer and use it in GitHub Desktop.
Ansible tutorial

Indirmek icin

$ brew install ansible

yeni inventory file

$ vi ~/hosts

[do]
134.122.x.x
138.197.x.x
142.93.x.x
157.230.x.x
161.35.x.x
167.71.x.x
178.128.x.x

[app]
116.202.x.x

Ping gondermek icin

$ ansible all --inventory-file=~/hosts -u root -m ping

Komut calistirmak icin

$ ansible all --inventory-file=~/hosts -u root -a 'uptime'

Playbook tutorial

first_playbook.yml dosyasi

- name: Run serp script
  hosts: do
  tasks:
    - name: running bash script
      command: zsh a.sh 10 200 200

$ ansible-playbook --inventory-file=~/hosts -u root first_playbook.yml

Extra

Ssh baglanirken fingerprint confirmini gecmek icin :D

$ export ANSIBLE_HOST_KEY_CHECKING=False

Her komutta --inventory-file=~/hosts yazmamak icin.

$ export ANSIBLE_HOSTS=~/hosts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment