File tree 2 files changed +52
-1
lines changed
2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : CD
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ dry_run :
7
+ type : boolean
8
+ description : " Run Ansible in dry-run mode"
9
+ required : false
10
+ default : false
11
+
12
+ jobs :
13
+ deploy :
14
+ runs-on : ubuntu-latest
15
+
16
+ steps :
17
+ - name : Checkout repository
18
+ uses : actions/checkout@v4
19
+
20
+ - name : Set up Python
21
+ uses : actions/setup-python@v5
22
+ with :
23
+ python-version : ' 3.x'
24
+
25
+ - name : Install Ansible
26
+ run : pip install ansible-core
27
+
28
+ - name : Deploy with Ansible
29
+ run : |
30
+ # Save the private SSH key
31
+ mkdir -p ~/.ssh
32
+ echo "${{ secrets.ANSIBLE_PRIVATE_KEY }}" > ~/.ssh/id_rsa
33
+ chmod 600 ~/.ssh/id_rsa
34
+
35
+ # Add the remote server's host key to known_hosts to avoid verification errors
36
+ ssh-keyscan -H ${{ vars.SERVER_NAME }} > ~/.ssh/known_hosts
37
+ chmod 600 ~/.ssh/known_hosts
38
+
39
+ # Construct ansible-playbook command
40
+ command="ansible-playbook playbook.yml -u root -i ${{ vars.SERVER_NAME }}, \
41
+ -e \"ServerName=${{ vars.SERVER_NAME }} ServerAdmin=${{ secrets.SERVER_ADMIN }} AdminPassword=${{ secrets.ADMIN_PASSWORD }} \
42
+ kofi_token=${{ secrets.KOFI_TOKEN }} paypal_clientid=${{ secrets.PAYPAL_CLIENT_ID }} \
43
+ paypal_secretkey=${{ secrets.PAYPAL_SECRET_KEY }} app_secret=${{ secrets.APP_SECRET }}\""
44
+
45
+ # Add dry-run option if specified
46
+ if ${{ inputs.dry_run }}; then
47
+ command="$command --check"
48
+ fi
49
+
50
+ # Run the Ansible playbook
51
+ eval $command
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ The website was made with `symfony new website --version="7.2.x"`
12
12
13
13
Put your MobileForces.zip in the root folder and run
14
14
15
- ` ansible-playbook - i mf.nofisto.com, playbook.yml -u root `
15
+ ` ansible-playbook playbook.yml -u root - i mf.nofisto.com, `
16
16
17
17
You may configure various options in the vars.yml file, by deafult this playbook relies on your MobileForces.zip creating a MobileForces folder
18
18
You can’t perform that action at this time.
0 commit comments