Skip to content

GitHub actions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 118 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
e8e07b1
Ignore dev folders
Teagan42 May 5, 2022
6413944
Update meta
Teagan42 May 5, 2022
690620b
Molecule and GitHub actions init
Teagan42 May 5, 2022
fa3c8c6
Fully qualified modules
Teagan42 May 5, 2022
7d35c80
Linting
Teagan42 May 6, 2022
c283b1f
Verify services
Teagan42 May 6, 2022
1d91b31
Converge playbook include common role
Teagan42 May 6, 2022
d787c17
Fix redhat package
Teagan42 May 6, 2022
306e9ba
Install ssh server
Teagan42 May 6, 2022
1e90f72
Fix package name
Teagan42 May 6, 2022
94465aa
epel release
Teagan42 May 6, 2022
06efdeb
remove packsge
Teagan42 May 6, 2022
54d6a40
Move epel and openssh to docker image
Teagan42 May 6, 2022
aa0e493
Update dockerfile
Teagan42 May 6, 2022
a07a283
Revert "Update dockerfile"
Teagan42 May 6, 2022
a807241
deub
Teagan42 May 6, 2022
924755d
ssh Agent
Teagan42 May 6, 2022
dd7d180
Type-o
Teagan42 May 6, 2022
e61094f
Start SSH command
Teagan42 May 6, 2022
eb4603b
SSH and systemd
Teagan42 May 6, 2022
1200a65
Dockerfile
Teagan42 May 6, 2022
a20269c
entrypoint
Teagan42 May 6, 2022
7867ce0
Use path
Teagan42 May 6, 2022
31967e1
Execute scrit
Teagan42 May 6, 2022
0da928e
Fix docker command
Teagan42 May 6, 2022
4e92e2b
copy
Teagan42 May 6, 2022
42798d3
file path
Teagan42 May 6, 2022
b4d6bb8
Copy source path
Teagan42 May 6, 2022
b6aaeff
Try to fix entrypoint
Teagan42 May 6, 2022
c14fb01
fix paths
Teagan42 May 6, 2022
ac660ce
Fix command
Teagan42 May 6, 2022
3bdab39
Dockerfile changes
Teagan42 May 6, 2022
b6c2d6e
systemctl
Teagan42 May 6, 2022
30e59d3
Try another ssh method
Teagan42 May 6, 2022
6dac86b
forget ssh
Teagan42 May 6, 2022
7e281bf
skip ssh
Teagan42 May 6, 2022
d8460ef
Update docker
Teagan42 May 6, 2022
d1a89b2
update dockerfile
Teagan42 May 6, 2022
1814441
Run sshd
Teagan42 May 6, 2022
d651068
System ssh
Teagan42 May 6, 2022
e481f05
remove openssh
Teagan42 May 6, 2022
eb8e2f1
Remove openssh from packages
Teagan42 May 6, 2022
3de54fb
remove command
Teagan42 May 6, 2022
dd84462
Flag for ssh
Teagan42 May 6, 2022
d4fbf7c
Remove arg
Teagan42 May 6, 2022
139c2a3
try vagrant
Teagan42 May 6, 2022
2f20af7
try gerling example
Teagan42 May 6, 2022
184c8fc
Linting
Teagan42 May 6, 2022
b941b37
fqm
Teagan42 May 6, 2022
87af5ef
Linting
Teagan42 May 6, 2022
e5d8de3
Set var
Teagan42 May 6, 2022
47f6db0
Typeo
Teagan42 May 6, 2022
5e79ee5
Update role_name
Teagan42 May 6, 2022
a0d2c59
linting
Teagan42 May 6, 2022
1463ce6
point to config
Teagan42 May 6, 2022
3258058
Linear strategy
Teagan42 May 6, 2022
bfea309
linting
Teagan42 May 6, 2022
5631fd0
sudo
Teagan42 May 6, 2022
6b5a218
type-o
Teagan42 May 6, 2022
f16ccfb
linting
Teagan42 May 6, 2022
38618f7
ignroe venv
Teagan42 May 6, 2022
952ece5
cleanup
Teagan42 May 6, 2022
2ffcfb2
lint
Teagan42 May 6, 2022
5a1c516
change command
Teagan42 May 6, 2022
4ec8bee
Check if container
Teagan42 May 6, 2022
2768ced
Ignore errors
Teagan42 May 6, 2022
c322ffb
Collection requirements
Teagan42 May 6, 2022
9fe101f
requirements
Teagan42 May 6, 2022
0fdeafe
Verify
Teagan42 May 6, 2022
c0ed87c
Workflow
Teagan42 May 6, 2022
947cf47
fix not
Teagan42 May 6, 2022
87e4289
fix
Teagan42 May 6, 2022
2c0c754
centos8
Teagan42 May 6, 2022
85d211f
Verify cockpit
Teagan42 May 6, 2022
98124e6
Linting
Teagan42 May 6, 2022
20f3376
Install apt package required for disable selinux task
Teagan42 May 6, 2022
7b6476b
Install apt package required for disable selinux task
Teagan42 May 6, 2022
de59541
use link
Teagan42 May 6, 2022
80dc178
use package
Teagan42 May 6, 2022
b896899
use package
Teagan42 May 6, 2022
9bed368
policy utils
Teagan42 May 6, 2022
d4a5dbe
use direct links
Teagan42 May 6, 2022
cee91ca
Install package
Teagan42 May 6, 2022
fb1379b
Install package
Teagan42 May 6, 2022
fe25521
Another package
Teagan42 May 6, 2022
33362f1
install python module
Teagan42 May 6, 2022
97d84d2
3.8
Teagan42 May 6, 2022
775422c
module
Teagan42 May 6, 2022
b56c2f9
python3 this bitch
Teagan42 May 6, 2022
2db2701
pip packages
Teagan42 May 6, 2022
06981f3
Ensure python interpreter
Teagan42 May 6, 2022
45251dd
set python interp
Teagan42 May 6, 2022
cd27be5
Interp
Teagan42 May 6, 2022
b52d3f3
Install firewalld
Teagan42 May 6, 2022
59e3672
Disable selinux
Teagan42 May 6, 2022
34bd127
Disable selinux
Teagan42 May 6, 2022
41f5897
ensure firewall is running
Teagan42 May 6, 2022
4979e4b
Specify python3.8 and add conditions to firewalld tasks
Teagan42 May 6, 2022
e081ae5
python3 package
Teagan42 May 6, 2022
262636b
use py3.8
Teagan42 May 6, 2022
fea6127
pin ansible
Teagan42 May 6, 2022
ed17a1d
Fix role
Teagan42 May 7, 2022
77566cd
Fix role
Teagan42 May 7, 2022
3fcc84d
Do not specify python client
Teagan42 May 7, 2022
e7f2d7d
Remove libselinux
Teagan42 May 7, 2022
ef3e0b1
disable selinux
Teagan42 May 7, 2022
0f74656
Firewalld
Teagan42 May 7, 2022
d6ae010
fix task
Teagan42 May 7, 2022
73ba171
remove package
Teagan42 May 7, 2022
e73feb5
Centos7
Teagan42 May 7, 2022
ac9b9ce
install firewalld
Teagan42 May 7, 2022
6d8e11c
Fix pretasks
Teagan42 May 7, 2022
eb1b7e1
remove firewalld restart
Teagan42 May 7, 2022
36f3621
Ensure firewalld is running
Teagan42 May 7, 2022
25885d1
lint
Teagan42 May 7, 2022
8740740
started
Teagan42 May 7, 2022
67f8679
Ensure cockpit service is known by firewalld
Teagan42 May 7, 2022
dbfcd08
remove package
Teagan42 May 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Molecule
on:
- push
- pull_request

env:
CI: true

defaults:
run:
working-directory: 'constructorfleet.ansible-common'

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'constructorfleet.ansible-common'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install test dependencies.
run: pip3 install yamllint

- name: Lint code.
run: |
yamllint -f parsable .

molecule:
name: Molecule
runs-on: ubuntu-latest
strategy:
matrix:
distro:
- centos7
- centos8
# - ubuntu2004
# - ubuntu1804
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
with:
path: 'constructorfleet.ansible-common'

- name: Set up Python 3.
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install test dependencies.
run: python -m pip install ansible==5.1.0 "molecule[docker]" docker

- name: Run Molecule tests.
run: python -m molecule test
env:
PY_COLORS: '1'
ANSIBLE_FORCE_COLOR: '1'
MOLECULE_DISTRO: ${{ matrix.distro }}
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish Role to Ansible Galaxy
on:
release:
types: [ created ]
jobs:
publish:
name: Publish to Ansible Galaxy
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Publish Ansible role to Galaxy
uses: robertdebock/[email protected]
with:
galaxy_api_key: ${{ secrets.GALAXY_API_TOKEN }}

24 changes: 24 additions & 0 deletions .github/workflows/tag-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tag on Merge

on:
push:
branches: [ main ]

env:
CI: true

jobs:
tag:
name: Tag Role
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: "${{ github.repository }}"
- name: Bump version and push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
WITH_V: true
DEFAULT_BUMP: minor
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv/
.idea/
38 changes: 38 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
extends: default

ignore: |
.github/
venv/

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: enable
comments-indentation: enable
document-start: enable
empty-lines:
max: 1
level: error
hyphens:
level: error
indentation:
spaces: 2
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy:
check-keys: false
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

Deploy common configurations and packages to servers.


## Requirements

N/A


## Role Variables

#### defaults/main.yml
Expand Down Expand Up @@ -88,7 +86,7 @@ N/A
```
- name: Deploy common server configurations
hosts: all
become: True
become: true
remote_user: root
tasks:
- include_role:
Expand Down
3 changes: 2 additions & 1 deletion common.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---

- name: Deploy common server configurations
hosts: all
remote_user: root
gather_facts: yes
gather_facts: true

tasks:
- import_role:
Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---

consoletty:
serialtty:

Expand All @@ -7,7 +8,7 @@ timezone: UTC
ssh_users: {}
ssh_groups: {}

common_enable_cockpit: False
common_enable_cockpit: false

common_pkgs: []

Expand Down
4 changes: 3 additions & 1 deletion fix-centos-user.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---

- name: fix root
hosts: all
remote_user: centos
become: True
become: true
tasks:
- import_role:
name: common
Expand Down
4 changes: 3 additions & 1 deletion fix-ubuntu-user.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---

- name: fix root
hosts: all
remote_user: ubuntu
become: True
become: true
tasks:
- import_role:
name: common
Expand Down
5 changes: 3 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---

- name: "restart_sshd"
set_fact:
sshd_require_restart: True
sshd_require_restart: true

- name: "update_grub_config"
set_fact:
grub_require_rebuild: True
grub_require_rebuild: true
47 changes: 6 additions & 41 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,14 @@
galaxy_info:
author: Alan Janis
description: Deploy Common server configurations and packages
role_name: common
namespace: constructorfleet
issue_tracker_url: https://github.com/constructorfleet/ansible-common/issue/tracker

# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: MIT

min_ansible_version: 2.9

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99

platforms:
- name: Ubuntu
versions:
Expand All @@ -47,14 +18,8 @@ galaxy_info:

galaxy_tags:
- common
- wwt
# 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
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
- ssh
- serial-over-lan
- cockpit

dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
22 changes: 22 additions & 0 deletions molecule/default/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******

Requirements
============

* Docker Engine

Install
=======

Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.

.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site

.. code-block:: bash

$ python3 -m pip install 'molecule[docker]'
46 changes: 46 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
- name: Converge
hosts: all
vars:
configure_ssh: false
storage_backend: NONE
host_is_container: true
enable_mdns_reflection: true
common_enable_cockpit: true
pre_tasks:
- name: Update apt cache.
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
when: ansible_os_family == 'Debian'

- name: Ensure Firewalld is installed.
ansible.builtin.package:
name: firewalld
state: present
when: ansible_os_family == 'RedHat'

- name: Wait for systemd to complete initialization. # noqa 303
ansible.builtin.command: systemctl is-system-running
register: systemctl_status
until: >
'running' in systemctl_status.stdout or
'degraded' in systemctl_status.stdout
retries: 30
delay: 5
when: ansible_service_mgr == 'systemd'
changed_when: false
failed_when: systemctl_status.rc > 1

- name: 'Restarting firewalld'
ansible.builtin.systemd:
name: firewalld
state: started
enabled: true
daemon_reload: true
when: ansible_os_family == 'RedHat'

tasks:
- name: Run common role
ansible.builtin.include_role:
name: constructorfleet.common
Loading