generated from the-liberated-edge/wikijs
i-1 Introduces an Ansible playbook for linux-container with SSH access #2
@ -2,8 +2,7 @@
|
||||
- name: Converge
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
|
||||
- name: imports and executes the playbook under test
|
||||
ansible.builtin.import_playbook: ../../../launch_linux_container.yml
|
||||
vars:
|
||||
lte_container_name: "{{ molecule_yml.platforms[0].name }}"
|
||||
lte_container_name: '{{ molecule_yml.platforms[0].name }}'
|
||||
|
||||
@ -5,17 +5,14 @@
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: find current container state
|
||||
ansible.builtin.command: "lxc ls {{ item.name }}"
|
||||
ansible.builtin.command: lxc ls {{ item.name }}
|
||||
register: container_state
|
||||
changed_when: false
|
||||
with_items: "{{ molecule_yml.platforms }}"
|
||||
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
- name: stop running containers
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
lxc stop {{ item.name }} && \
|
||||
lxc rm {{ item.name }}
|
||||
when:
|
||||
(container_state.results[0].rc == 0) and
|
||||
("RUNNING" in container_state.results[0].stdout)
|
||||
with_items: "{{ molecule_yml.platforms }}"
|
||||
when: (container_state.results[0].rc == 0) and ("RUNNING" in container_state.results[0].stdout)
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
|
||||
@ -4,12 +4,9 @@
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: find current container state
|
||||
ansible.builtin.command: "lxc ls {{ item.name }}"
|
||||
ansible.builtin.command: lxc ls {{ item.name }}
|
||||
register: container_state
|
||||
with_items: "{{ molecule_yml.platforms }}"
|
||||
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
- name: verify launched container is running
|
||||
assert:
|
||||
that:
|
||||
(container_state.results[0].rc == 0) and
|
||||
("RUNNING" in container_state.results[0].stdout)
|
||||
that: (container_state.results[0].rc == 0) and ("RUNNING" in container_state.results[0].stdout)
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
---
|
||||
### REQUIRED
|
||||
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
|
||||
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
|
||||
@ -12,22 +13,17 @@ version: 1.0.0
|
||||
|
||||
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
|
||||
readme: README.md
|
||||
|
||||
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
|
||||
# @nicks:irc/im.site#channel'
|
||||
authors:
|
||||
- your name <example@domain.com>
|
||||
|
||||
|
||||
- your name <example@domain.com>
|
||||
### OPTIONAL but strongly recommended
|
||||
# A short summary description of the collection
|
||||
description: your collection description
|
||||
|
||||
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
|
||||
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
|
||||
license:
|
||||
- GPL-2.0-or-later
|
||||
|
||||
- GPL-2.0-or-later
|
||||
# The path to the license file for the collection. This path is relative to the root of the collection. This key is
|
||||
# mutually exclusive with 'license'
|
||||
license_file: ''
|
||||
@ -66,4 +62,3 @@ build_ignore: []
|
||||
# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive
|
||||
# with 'build_ignore'
|
||||
# manifest: null
|
||||
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
---
|
||||
|
||||
- name: launch linux container
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Create a test container image template
|
||||
ansible.builtin.import_role:
|
||||
name: linux_container
|
||||
- name: Create a test container image template
|
||||
ansible.builtin.import_role:
|
||||
name: linux_container
|
||||
|
||||
@ -1,52 +1,2 @@
|
||||
---
|
||||
# Collections must specify a minimum required ansible version to upload
|
||||
# to galaxy
|
||||
# requires_ansible: '>=2.9.10'
|
||||
|
||||
# Content that Ansible needs to load from another location or that has
|
||||
# been deprecated/removed
|
||||
# plugin_routing:
|
||||
# action:
|
||||
# redirected_plugin_name:
|
||||
# redirect: ns.col.new_location
|
||||
# deprecated_plugin_name:
|
||||
# deprecation:
|
||||
# removal_version: "4.0.0"
|
||||
# warning_text: |
|
||||
# See the porting guide on how to update your playbook to
|
||||
# use ns.col.another_plugin instead.
|
||||
# removed_plugin_name:
|
||||
# tombstone:
|
||||
# removal_version: "2.0.0"
|
||||
# warning_text: |
|
||||
# See the porting guide on how to update your playbook to
|
||||
# use ns.col.another_plugin instead.
|
||||
# become:
|
||||
# cache:
|
||||
# callback:
|
||||
# cliconf:
|
||||
# connection:
|
||||
# doc_fragments:
|
||||
# filter:
|
||||
# httpapi:
|
||||
# inventory:
|
||||
# lookup:
|
||||
# module_utils:
|
||||
# modules:
|
||||
# netconf:
|
||||
# shell:
|
||||
# strategy:
|
||||
# terminal:
|
||||
# test:
|
||||
# vars:
|
||||
|
||||
# Python import statements that Ansible needs to load from another location
|
||||
# import_redirection:
|
||||
# ansible_collections.ns.col.plugins.module_utils.old_location:
|
||||
# redirect: ansible_collections.ns.col.plugins.module_utils.new_location
|
||||
|
||||
# Groups of actions/modules that take a common set of options
|
||||
# action_groups:
|
||||
# group_name:
|
||||
# - module1
|
||||
# - module2
|
||||
...
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
---
|
||||
# defaults file for linux_container
|
||||
...
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
---
|
||||
# handlers file for linux_container
|
||||
...
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
@ -15,7 +16,6 @@ galaxy_info:
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
@ -38,7 +38,6 @@ galaxy_info:
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
@ -46,7 +45,6 @@ galaxy_info:
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
||||
@ -1,15 +1,12 @@
|
||||
---
|
||||
- name: find current container state
|
||||
ansible.builtin.command: "lxc ls {{ lte_container_name }}"
|
||||
ansible.builtin.command: lxc ls {{ lte_container_name }}
|
||||
register: container_state
|
||||
changed_when: false
|
||||
|
||||
- name: launch debian bookworm linux container
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
lxc launch \
|
||||
images:debian/bookworm/cloud \
|
||||
{{ lte_container_name }}
|
||||
when:
|
||||
(container_state.rc == 1) or
|
||||
("RUNNING" not in container_state.stdout)
|
||||
when: (container_state.rc == 1) or ("RUNNING" not in container_state.stdout)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- linux_container
|
||||
roles: [linux_container]
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
---
|
||||
# vars file for linux_container
|
||||
...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user