-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matthew B White <[email protected]>
- Loading branch information
Showing
6 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- hosts: localhost | ||
tasks: | ||
- ansible.builtin.debug: | ||
msg: "Hello" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run Playbook | ||
uses: ./ | ||
with: | ||
playbook: .github/playbooks/000-hello.yaml | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM ghcr.io/ibm-blockchain/fabric-ansible:2.0.0-beta | ||
USER root | ||
RUN curl -sSL https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o /usr/local/bin/jq \ | ||
&& chmod +x /usr/local/bin/jq | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# fabric-ansible-action | ||
GitHub Action to run Ansible Playbooks for Hyperledger Fabric | ||
# :gear: `fabric-ansible-action` | ||
> Action to setup Hyperledger Fabric CLIs | ||
## About | ||
|
||
This action will run an Ansible Playbook using the ["Ansible Collection For Fabric"](https://github.com/IBM-Blockchain/ansible-collection) | ||
It is based off the [v2.0.0-beta docker image](https://github.com/IBM-Blockchain/ansible-collection/pkgs/container/fabric-ansible). | ||
## Usage | ||
|
||
To run a playbook | ||
|
||
```yaml | ||
- name: Create the Fabric Operations Console | ||
uses: hyperledgendary/fabric-ansible-action | ||
with: | ||
playbook: playbooks/operator_console_playbooks/02-console-install.yml | ||
``` | ||
To run a playbook with an additional Ansible Arugments file | ||
```yaml | ||
- name: Create the Fabric Operations Console | ||
uses: hyperledgendary/fabric-ansible-action | ||
with: | ||
playbook: playbooks/operator_console_playbooks/02-console-install.yml | ||
argsfile: _cfg/domain.yml | ||
``` | ||
## Inputs | ||
The actions supports the following inputs: | ||
- `playbook`: Path to the playbook to run | ||
- `argsfile`: path to an additional args file to supply to Ansible (standard Ansible yaml format) | ||
|
||
|
||
## License | ||
[APACAHE-2.0](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# action.yml | ||
name: 'Fabric Ansible Action' | ||
description: 'Fabric Ansible Action' | ||
inputs: | ||
playbook: # id of input | ||
description: 'playbook to run' | ||
required: true | ||
default: 'playbook.yaml' | ||
argsfile: # id of input | ||
description: 'additional args file' | ||
required: false | ||
# outputs: | ||
# time: # id of output | ||
# description: 'The time we greeted you' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.playbook }} | ||
- ${{ inputs.argsfile }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
set -xeuo pipefail | ||
export INPUT_PLAYBOOK=$1 | ||
export ARGSFILE=${2:-none} | ||
|
||
echo $INPUT_PLAYBOOK | ||
echo $ARGSFILE | ||
|
||
echo $GITHUB_WORKSPACE | ||
whoami | ||
pwd | ||
|
||
export PYTHONPATH=/home/ibp-user/.local/lib/python3.9/site-packages | ||
export HOME=/home/ibp-user | ||
# cd ${HOME} | ||
|
||
export KUBECONFIG="${GITHUB_WORKSPACE}/_cfg/k8s_context.yaml" | ||
|
||
export IBP_ANSIBLE_LOG_FILENAME=${GITHUB_WORKSPACE}/_cfg/__ansible.log | ||
|
||
if [[ $ARGSFILE == "none" ]]; then | ||
ansible-playbook -e ROOT=${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/${INPUT_PLAYBOOK} | ||
else | ||
ansible-playbook -e ROOT=${GITHUB_WORKSPACE} --extra-vars "@${GITHUB_WORKSPACE}/${ARGSFILE}" ${GITHUB_WORKSPACE}/${INPUT_PLAYBOOK} | ||
fi |