Giter VIP home page Giter VIP logo

learn-ansible's Introduction

Learning Ansible

練習使用 Ansible 做 IaC。

  • host.ini: 主機連線的資料
  • ansible.cfg: 設定檔
ansible-playbook -i host.ini playbook.yml -kK
ansible-playbook playbook.yml # 因為 ansible.cfg 已經都設定好了,所以不加參數也沒關係

如果要設定更複雜的 host 資訊,host.ini 可以改成 yaml 寫法 (放在 inventory/ 目錄下 e.g., inventory/hosts.yml)。

前置作業

設定網卡

Router (ubuntu2204)

sudo ip link set enp0s8 up # Internal NIC 要開起來
sudo ip addr add 192.168.32.254/24 dev enp0s8

# sudo ip route flush all
ip route add 10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100 
ip route add 10.0.2.2 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100 
ip route add 10.0.2.3 dev enp0s3 proto dhcp scope link src 10.0.2.15 metric 100 
ip route add 10.113.0.0/16 dev wg0 scope link 
ip route add 192.168.32.0/24 dev enp0s8 scope link 
ip route add default via 10.0.2.2 dev enp0s3 proto dhcp src 10.0.2.15 metric 100 

learn-ansible's People

Contributors

lnfu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.