Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrelamberty committed Aug 31, 2023
1 parent 80df1e6 commit 46f21e9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 26 deletions.
Empty file.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Editor
.vscode

# Configuration
*hosts.ini
37 changes: 11 additions & 26 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,38 @@
vars:
debug: true
tasks:
- name: Print all available facts
ansible.builtin.debug:
var: ansible_facts
when: debug==true

- name: OS Informations
debug:
msg:
- "Architecture: {{ ansible_architecture }}"
- "Distribution: {{ ansible_distribution|lower }}"
- "Realease: {{ ansible_distribution_release }}"
- "Version: {{ ansible_distribution_major_version }}"
- "DNS: {{ ansible_dns.nameservers }}"

- name: Update and upgrade apt packages
become: true
apt:
upgrade: yes
update_cache: yes
ansible.builtin.apt:
upgrade: true
update_cache: true
cache_valid_time: 86400

- name: Install Docker
apt:
ansible.builtin.apt:
name: ["runc", "docker.io", "docker-compose"]
allow_unauthenticated: true
state: latest
state: present
become: true
become_method: sudo

- name: Create "docker" group
group:
ansible.builtin.group:
name: "docker"
state: present

- name: Add "pi" user to "docker" group
user:
ansible.builtin.user:
name: "pi"
groups: "docker"
append: yes
append: true

# https://docs.ansible.com/ansible/latest/collections/community/docker/docker_container_module.html#ansible-collections-community-docker-docker-container-module
- name: Create portainer container
docker_container:
community.docker.docker_container:
name: portainer
image: portainer/portainer-ce
state: started
recreate: yes
recreate: true
restart_policy: always
published_ports:
- "8000:8000"
Expand All @@ -60,6 +45,6 @@
- portainer_data:/data

- name: Congratulations!
debug:
ansible.builtin.debug:
msg:
- "Your Raspi is ready now!"
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
collections:
- name: community.docker
- name: community.general

0 comments on commit 46f21e9

Please sign in to comment.