1
2
3
- **Lecture 12:** We used FABRIC to provision raw, blank hardware on FABRIC.
- **Lecture 14 (Next):** We want to use Docker Swarm to deploy containers.
- **The Missing Link:** The raw FABRIC nodes don't have Docker installed. We need a way to configure them automatically to satisfy our course project requirements.
what the system state should look like, and Ansible will handle how to achieve it.
1
2
3
4
5
- Writing a Bash script to install Docker is imperative and fragile. If you run `mkdir` twice, it can generate
an error, which then can cause a crash.
- **Ansible** is based on the mathematical concept of **Idempotency** ($f(f(x)) = f(x)$).
- An operation is idempotent if applying it multiple times has the same effect as applying it once.
- Ansible modules check the current state first; if the software is already installed, it does nothing.
1
2
3
4
- Ansible treats your infrastructure as a state machine.
- $S_0$: The blank FABRIC node.
- $Transition$: The Ansible Playbook (declarative code).
- $S_{final}$: The node configured exactly as desired (Docker installed, security policies set).
[managers], [workers]), orupload the installation directory, then execute the uploaded scripts:
1
2
node.upload_directory('scripts','.')
node.execute('bash scripts/web_server.sh', quiet=True, output_file=f"{node.get_name()}.log")
Develop an Ansible playbook to setup Docker inside a single-node slice.