Skip to content
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

feat: deploy main playbook manually #17

Merged
merged 4 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
43 changes: 43 additions & 0 deletions .github/workflows/deploy-to-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to Production

"on":
workflow_dispatch:
inputs:
extra-ansible-options:
description: Extra ansible-playbook options
required: false

env:
# renovate: datasource=pypi depName=ansible-core
ANSIBLE_CORE_VERSION: 2.12.3

jobs:
deploy:
runs-on: self-hosted
environment: production
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout
# yamllint disable-line rule:line-length
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2

- name: Set up Python
# yamllint disable-line rule:line-length
uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # tag=v3.1.2
with:
# renovate: datasource=docker depName=python versioning=docker
python-version: 3.10.4

- name: Install ansible
run: pip install ansible-core==$ANSIBLE_CORE_VERSION

- name: Run playbook
# yamllint disable-line rule:line-length
uses: dawidd6/action-ansible-playbook@v2
with:
playbook: main.yml
key: ${{ secrets.ANSIBLE_SSH_PRIVATE_KEY }}
options: >
--inventory hosts.yml
${{ github.event.inputs.extra-ansible-options }}
6 changes: 6 additions & 0 deletions ansible/hosts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
all:
children:
workstations:
hosts:
workstation-pop-os.domantaki.com:
7 changes: 2 additions & 5 deletions ansible/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
---
- name: Main
hosts: all
become: true

tasks:
- name: Update apt package cache
ansible.builtin.apt:
update_cache: true
cache_valid_time: 3600
- name: Ping
ansible.builtin.ping: