Create docker role
This commit is contained in:
parent
c747de04a7
commit
80969c59ca
58
roles/docker/README.md
Normal file
58
roles/docker/README.md
Normal file
@ -0,0 +1,58 @@
|
||||
<!--
|
||||
Copyright 2025 Code Fox
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
Docker
|
||||
=========
|
||||
|
||||
Sets up Docker on Ubuntu
|
||||
|
||||
- Installation
|
||||
- Uninstallation
|
||||
- Updates
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
- Ubuntu 24.04 (or newer)
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
- [ubuntu](../ubuntu/README.md)
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
[Apache 2.0](../../LICENSE.md)
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
- [Code Fox](https://c0de.dev)
|
17
roles/docker/defaults/main.yml
Normal file
17
roles/docker/defaults/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright 2025 Code Fox
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# defaults file for docker
|
33
roles/docker/meta/main.yml
Normal file
33
roles/docker/meta/main.yml
Normal file
@ -0,0 +1,33 @@
|
||||
# Copyright 2025 Code Fox
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
galaxy_info:
|
||||
author: Code Fox
|
||||
company: Code Fox LLC
|
||||
license: Apache-2.0
|
||||
|
||||
description: |
|
||||
Manages Docker on Ubuntu
|
||||
|
||||
- Installation
|
||||
- Uninstallation (TODO)
|
||||
- Update Version
|
||||
|
||||
min_ansible_version: "2.18"
|
||||
galaxy_tags:
|
||||
- docker
|
||||
- c0defox
|
||||
|
||||
dependencies:
|
||||
- role: ubuntu
|
50
roles/docker/tasks/main.yml
Normal file
50
roles/docker/tasks/main.yml
Normal file
@ -0,0 +1,50 @@
|
||||
# Copyright 2025 Code Fox
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
---
|
||||
|
||||
- name: Add Docker GPG key for apt
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
|
||||
- name: Add Docker Repository
|
||||
apt_repository:
|
||||
repo: deb https://download.docker.com/linux/ubuntu focal stable
|
||||
state: present
|
||||
|
||||
- name: Install Docker
|
||||
apt:
|
||||
pkg:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
state: latest
|
||||
update_cache: true
|
||||
|
||||
- name: Install Docker Module for Python
|
||||
pip:
|
||||
name: docker
|
||||
|
||||
- name: Reload SystemD
|
||||
ansible.builtin.systemd_service:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Enable Docker service
|
||||
ansible.builtin.systemd:
|
||||
enabled: true
|
||||
state: started
|
||||
name: docker
|
17
roles/docker/vars/main.yml
Normal file
17
roles/docker/vars/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright 2025 Code Fox
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#SPDX-License-Identifier: MIT-0
|
||||
---
|
||||
# vars file for docker
|
Loading…
x
Reference in New Issue
Block a user