ComplianceAsCode / content

Security automation content in SCAP, Bash, Ansible, and other formats
https://complianceascode.readthedocs.io/en/latest/
Other
2.17k stars 690 forks source link

document ansible playbook upload script #3738

Closed shawndwells closed 1 year ago

shawndwells commented 5 years ago

current script will remove all existing repos under an organizational account and replace them with an ansible template!

$ PYTHONPATH=`./.pyenv.sh` utils/upload_ansible_roles_to_galaxy.py --organization RedHatOfficial --build-roles-dir ./build/roles/
Input your GitHub credentials:
username or token: <<token>>
password (or empty for token):
Creating new Github repository: rhel7-role-C2S
Creating new Github repository: rhel7-role-cjis
Creating new Github repository: rhel7-role-hipaa
Creating new Github repository: rhel7-role-nist-800-171-cui
Creating new Github repository: rhel7-role-ospp
Creating new Github repository: rhel7-role-pci-dss
Creating new Github repository: rhel7-role-rht-ccp
Creating new Github repository: rhel7-role-stig-rhel7-disa
Cloning into 'miq-LDAP'...
FIPS mode initialized
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 724 (delta 6), reused 14 (delta 6), pack-reused 701
Receiving objects: 100% (724/724), 121.91 KiB | 0 bytes/s, done.
Resolving deltas: 100% (390/390), done.
- miq-LDAP was created successfully
[master 5c0b779] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 155 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.66 KiB | 0 bytes/s, done.
Total 16 (delta 0), reused 0 (delta 0)
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least 1 approving review is required by reviewers with write access.
To git@github.com:RedHatOfficial/miq-LDAP.git
 ! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'git@github.com:RedHatOfficial/miq-LDAP.git'
Cloning into 'miq-RedHat-Satellite6'...
FIPS mode initialized
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 1180 (delta 1), reused 7 (delta 0), pack-reused 1168
Receiving objects: 100% (1180/1180), 188.03 KiB | 0 bytes/s, done.
Resolving deltas: 100% (586/586), done.
- miq-RedHat-Satellite6 was created successfully
[master a0c4483] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 40 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.80 KiB | 0 bytes/s, done.
Total 16 (delta 0), reused 0 (delta 0)
To git@github.com:RedHatOfficial/miq-RedHat-Satellite6.git
   64e129e..a0c4483  master -> master
Cloning into 'product-demo-template'...
FIPS mode initialized
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 6 (delta 0), reused 6 (delta 0), pack-reused 0
Receiving objects: 100% (6/6), 24.75 KiB | 0 bytes/s, done.
- product-demo-template was created successfully
[master a57e93b] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 30 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.69 KiB | 0 bytes/s, done.
Total 16 (delta 0), reused 0 (delta 0)
To git@github.com:RedHatOfficial/product-demo-template.git
   2105cea..a57e93b  master -> master
Cloning into 'IoT_Summit_Lab'...
FIPS mode initialized
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 1959 (delta 0), reused 0 (delta 0), pack-reused 1957
Receiving objects: 100% (1959/1959), 7.85 MiB | 955.00 KiB/s, done.
Resolving deltas: 100% (404/404), done.
- IoT_Summit_Lab was created successfully
[master 9e2f7c7] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+)
 create mode 100644 README.md
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 17, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.59 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To git@github.com:RedHatOfficial/IoT_Summit_Lab.git
   6a49832..9e2f7c7  master -> master
Cloning into 'miq-Utilities'...
FIPS mode initialized
remote: Enumerating objects: 118, done.
remote: Counting objects: 100% (118/118), done.
remote: Compressing objects: 100% (90/90), done.
remote: Total 2639 (delta 41), reused 82 (delta 28), pack-reused 2521
Receiving objects: 100% (2639/2639), 435.35 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1484/1484), done.
- miq-Utilities was created successfully
[master f69984f] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 115 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.57 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least 1 approving review is required by reviewers with write access.
To git@github.com:RedHatOfficial/miq-Utilities.git
 ! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'git@github.com:RedHatOfficial/miq-Utilities.git'
Cloning into 'ansible-redhat_satellite6'...
FIPS mode initialized
remote: Enumerating objects: 187, done.
remote: Total 187 (delta 0), reused 0 (delta 0), pack-reused 187
Receiving objects: 100% (187/187), 33.81 KiB | 0 bytes/s, done.
Resolving deltas: 100% (61/61), done.
- ansible-redhat_satellite6 was created successfully
[master dee9f48] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 11 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 19, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (16/16), 2.81 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To git@github.com:RedHatOfficial/ansible-redhat_satellite6.git
   88deffb..dee9f48  master -> master
Cloning into 'ose-pivproxy'...
FIPS mode initialized
remote: Enumerating objects: 270, done.
remote: Total 270 (delta 0), reused 0 (delta 0), pack-reused 270
Receiving objects: 100% (270/270), 46.42 KiB | 0 bytes/s, done.
Resolving deltas: 100% (174/174), done.
- ose-pivproxy was created successfully
[master 2874611] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 338 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.57 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To git@github.com:RedHatOfficial/ose-pivproxy.git
   1efb447..2874611  master -> master
Cloning into 'rhos-vyos-nfv-demo'...
FIPS mode initialized
remote: Enumerating objects: 29, done.
remote: Total 29 (delta 0), reused 0 (delta 0), pack-reused 29
Receiving objects: 100% (29/29), 16.37 KiB | 0 bytes/s, done.
Resolving deltas: 100% (7/7), done.
- rhos-vyos-nfv-demo was created successfully
[master 5a83568] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 71 deletions(-)
 rewrite README.md (98%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.70 KiB | 0 bytes/s, done.
Total 16 (delta 0), reused 0 (delta 0)
To git@github.com:RedHatOfficial/rhos-vyos-nfv-demo.git
   182ef7d..5a83568  master -> master
Cloning into 'CO.LAB'...
FIPS mode initialized
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 123 (delta 3), reused 0 (delta 0), pack-reused 108
Receiving objects: 100% (123/123), 2.52 MiB | 3.21 MiB/s, done.
Resolving deltas: 100% (35/35), done.
- CO.LAB was created successfully
[master c48860a] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 17 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 18, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (16/16), 2.66 KiB | 0 bytes/s, done.
Total 16 (delta 0), reused 0 (delta 0)
To git@github.com:RedHatOfficial/CO.LAB.git
   a195476..c48860a  master -> master
Cloning into 'ansible-cloud_utils'...
FIPS mode initialized
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 111 (delta 0), reused 3 (delta 0), pack-reused 106
Receiving objects: 100% (111/111), 27.79 KiB | 0 bytes/s, done.
Resolving deltas: 100% (54/54), done.
- ansible-cloud_utils was created successfully
[master d49d955] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 68 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 19, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (16/16), 2.70 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To git@github.com:RedHatOfficial/ansible-cloud_utils.git
   5393e33..d49d955  master -> master
Cloning into 'ansible-redhat_openshift_utils'...
FIPS mode initialized
remote: Enumerating objects: 217, done.
remote: Total 217 (delta 0), reused 0 (delta 0), pack-reused 217
Receiving objects: 100% (217/217), 51.69 KiB | 0 bytes/s, done.
Resolving deltas: 100% (120/120), done.
- ansible-redhat_openshift_utils was created successfully
[master dbcc108] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 41 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 19, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (16/16), 2.66 KiB | 0 bytes/s, done.
Total 16 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To git@github.com:RedHatOfficial/ansible-redhat_openshift_utils.git
   eadd097..dbcc108  master -> master
Cloning into 'ansible-redhat_cloudforms'...
FIPS mode initialized
remote: Enumerating objects: 212, done.
remote: Total 212 (delta 0), reused 0 (delta 0), pack-reused 212
Receiving objects: 100% (212/212), 45.35 KiB | 0 bytes/s, done.
Resolving deltas: 100% (115/115), done.
- ansible-redhat_cloudforms was created successfully
[master 78bcceb] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 166 deletions(-)
 rewrite README.md (99%)
 create mode 100644 defaults/main.yml
 create mode 100644 handlers/main.yml
 create mode 100644 meta/main.yml
 create mode 100644 tasks/main.yml
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 create mode 100644 vars/main.yml
FIPS mode initialized
Counting objects: 19, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (16/16), 2.79 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least 1 approving review is required by reviewers with write access.
To git@github.com:RedHatOfficial/ansible-redhat_cloudforms.git
 ! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'git@github.com:RedHatOfficial/ansible-redhat_cloudforms.git'
Cloning into 'ansible-role-manageiq_workers'...
FIPS mode initialized
remote: Enumerating objects: 91, done.
remote: Total 91 (delta 0), reused 0 (delta 0), pack-reused 91
Receiving objects: 100% (91/91), 20.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (33/33), done.
- ansible-role-manageiq_workers was created successfully
[master 0b68652] Initial commit
 Author: Red Hat Security Automation development team <scap-security-guide@lists.fedorahosted.org>
 8 files changed, 113 insertions(+), 226 deletions(-)
 rewrite README.md (99%)
 rewrite defaults/main.yml (99%)
 create mode 100644 handlers/main.yml
 rewrite meta/main.yml (88%)
 rewrite tasks/main.yml (99%)
 create mode 100644 tests/inventory
 create mode 100644 tests/test.yml
 rewrite vars/main.yml (99%)
FIPS mode initialized
Counting objects: 26, done.
Delta compression using up to 3 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (16/16), 2.73 KiB | 0 bytes/s, done.
Total 16 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To git@github.com:RedHatOfficial/ansible-role-manageiq_workers.git
   c7100bf..0b68652  master -> master
Cloning into 'rhsummitlabs-2018'...
FIPS mode initialized
remote: Enumerating objects: 3204, done.
^CKilled by signal 2.cts:  17% (560/3204), 6.86 MiB | 1.36 MiB/s
fatal: The remote end hung up unexpectedly
^C [ERROR]: User interrupted execution

^C^CTraceback (most recent call last):
  File "utils/upload_ansible_roles_to_galaxy.py", line 400, in <module>
    main()
  File "utils/upload_ansible_roles_to_galaxy.py", line 386, in main
    locally_clone_and_init_repositories(args.organization, github_repositories)
  File "utils/upload_ansible_roles_to_galaxy.py", line 352, in locally_clone_and_init_repositories
    shutil.rmtree(temp_dir)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib64/python2.7/shutil.py", line 250, in rmtree
    os.remove(fullname)
KeyboardInterrupt
^C
matusmarhefka commented 5 years ago

So what is expected for this issue? Only document the script or also update it somehow? Where should the documentation go?

shawndwells commented 5 years ago

1) Full usage instructions should be documented 2) Script behavior should change, do not blow away content in existing organizational repos that have nothing to do with ansible playbooks! 3) Currently the script doesn't work. If organization does not have playbook repos they will be created, but no content is uploaded to them. If org does have repos (e.g. they just need to be updated), nothing is uploaded to them

jan-cerny commented 5 years ago

There is a PR by @redhatrises https://github.com/ComplianceAsCode/content/pull/4055

marcusburghardt commented 1 year ago

Documentation was introduced by https://github.com/ComplianceAsCode/content/pull/4055/