Skip to content

Commit

Permalink
added variables and github secrets test run
Browse files Browse the repository at this point in the history
  • Loading branch information
KevJimenez committed Feb 2, 2024
1 parent 352175c commit a51e126
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@ jobs:

- name: Run Ansible Playbook
run: ansible-playbook -i aws_ec2.yml playbook.yml

env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_KEY: ${{ secrets.DOCKER_KEY }}
CF_EMAIL: ${{ secrets.CF_EMAIL }}
CF_API: ${{ secrets.CF_API }}
ZONECF_ID: ${{ secrets.ZONECF_ID }}
PUB_KEY: ${{ secrets.PUB_KEY }}
...
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
terraform.tfstate.backup
terraform.tfvars
.terraform.lock.hcl
.terraform/
.vscode/settings.json
Expand Down
34 changes: 23 additions & 11 deletions playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@

tasks:

- name: Install Apache
apt:
name: apache2
state: present

- name: Ensure apache is running
service:
name: apache2
state: started

- name: Install Docker Prerequisites
shell: |
sudo apt-get install ca-certificates curl
Expand All @@ -43,4 +33,26 @@
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
...

- name: Log in to DockerHub
become_user: ubuntu
community.docker.docker_login:
username: {{ lookup('env', 'DOCKER_USER') }}
password: {{ lookup('env', 'DOCKER_KEY') }}

- name: Install Docker Watchtower
community.docker.docker_container:
name: watchtower
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /home/ubuntu/.docker/config.json:/config.json
command: -i 15 --cleanup=true

- name: Install Docker Static Web Portfolio
community.docker.docker_container:
name: kjstatic
image: kevjimenez/kjstatic
ports:
- 80:80
...
6 changes: 6 additions & 0 deletions terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Secret Keys

cf_api = \"{{ lookup('env', 'CF_API') }}\"
cf_email = \"{{ lookup('env', 'CF_EMAIL') }}\"
zonecf_id = \"{{ lookup('env', 'ZONECF_ID') }}\"
pub_key = \"{{ lookup('env', 'PUB_KEY') }}\"

0 comments on commit a51e126

Please sign in to comment.