{"id":23235940,"url":"https://github.com/hack-light/ansible-config-mgt","last_synced_at":"2026-03-20T01:02:33.241Z","repository":{"id":123069020,"uuid":"553069385","full_name":"Hack-Light/ansible-config-mgt","owner":"Hack-Light","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-15T20:49:51.000Z","size":158,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T20:36:33.150Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hack-Light.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-17T17:03:22.000Z","updated_at":"2022-10-29T04:50:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"d00bfd44-ae5b-4ea6-bab9-066c4d5e4789","html_url":"https://github.com/Hack-Light/ansible-config-mgt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Hack-Light/ansible-config-mgt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fansible-config-mgt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fansible-config-mgt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fansible-config-mgt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fansible-config-mgt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hack-Light","download_url":"https://codeload.github.com/Hack-Light/ansible-config-mgt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hack-Light%2Fansible-config-mgt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261558795,"owners_count":23177091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-19T03:30:00.838Z","updated_at":"2026-02-28T05:04:29.441Z","avatar_url":"https://github.com/Hack-Light.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ANSIBLE-CONFIG-MGT\n\n### STEPS\n\n- Install git\n- clone repo to instance\n- install java\n\n`sudo apt update`\n\n`sudo apt install openjdk-11-jre`\n\n- install jenkins\n```bash\ncurl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \\\n  /usr/share/keyrings/jenkins-keyring.asc \u003e /dev/null\n\necho deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \\\n  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \\\n  /etc/apt/sources.list.d/jenkins.list \u003e /dev/null\n\nsudo apt-get update\n\nsudo apt-get install jenkins\n\nsudo systemctl enable jenkins\n\nsudo systemctl start jenkins\n\nsudo systemctl status jenkins\n```\n- Setup jenkins\n\n`sudo cat /var/lib/jenkins/secrets/initialAdminPassword`\n\n- Install blue ocean plugin on jenkins\n\n- install ansible on the server\n\n\n## Documentation\n---\n## Dependences to be installed (rhel)\n`yum install python3 python3-pip wget unzip git -y`\n\n```bash\nyum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm\n\nyum install -y dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm\n```\n\n\n```python\npython3 -m pip install --upgrade setuptools\npython3 -m pip install --upgrade pip\npython3 -m pip install PyMySQL\npython3 -m pip install mysql-connector-python\npython3 -m pip install psycopg2-binary\n```\n---\n\n## Installing  JAVA (rehl)\n\n`sudo yum install java-11-openjdk-devel -y`\n\n### Open the bash profile \n`vi .bash_profile`\n\n## Paste the below in the bash profile\n\n```config\nexport JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))\n\nexport PATH=$PATH:$JAVA_HOME/bin\n\nexport CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar\n```\n\n## Reload the bash profile\n\n`source ~/.bash_profile`\n\n---\n\n## Install  php\n\n```bash\n# RHEL\nyum module reset php -y\n\nyum module enable php:remi-7.4 -y\n\nyum install -y php7.4  php7.4-common php7.4-mbstring php7.4-opcache php7.4-intl php7.4-xml php7.4-gd php7.4-curl php7.4-mysqlnd php7.4-fpm php7.4-json\n\nsystemctl start php-fpm\n\nsystemctl enable php-fpm\n```\n\n```bash\n\nsudo apt -y install software-properties-common\n\nsudo add-apt-repository ppa:ondrej/php\n\nsudo apt-get update\n\nsudo apt -y install php7.4\n\nphp -v\n\nsudo apt-get install php7.4-PACKAGE_NAME\n\nsudo apt-get install -y php7.4-common php7.4-mbstring php7.4-opcache php7.4-intl php7.4-xml php7.4-gd php7.4-curl php7.4-mysqlnd php7.4-fpm php7.4-json\n\nsystemctl start php7.4-fpm\n\nsystemctl enable php7.4-fpm\n\n# This command will install the following modules:\n\n# php7.4-cli - command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasks\n# php7.4-json - for working with JSON data\n# php7.4-common - documentation, examples, and common modules for PHP\n# php7.4-mysql - for working with MySQL databases\n# php7.4-zip - for working with compressed files\n# php7.4-gd - for working with images\n# php7.4-mbstring - used to manage non-ASCII strings\n# php7.4-curl - lets you make HTTP requests in PHP\n# php7.4-xml - for working with XML data\n# php7.4-bcmath - used when working with precision floats\n\n\n# PHP configurations related to Apache are stored in /etc/php/7.4/apache2/php.ini. You can list all loaded PHP modules with the following command:\nphp -m\n```\n\n---\n## Ansible dependencies to install\n\n* For Mysql Database\n    - `ansible-galaxy collection install community.mysql`\n\n* For Postgresql Database \n    - `ansible-galaxy collection install community.postgresql`\n\n---\n\n## Install composer\n\n```bash\ncurl -sS https://getcomposer.org/installer | php \nsudo mv composer.phar /usr/bin/composer\n```\n\n## Verify Composer is installed or not\n\n`composer --version`\n\n---\n\n## Install phpunit, phploc\n\n```sudo\nsudo dnf --enablerepo=remi install php-phpunit-phploc\nwget -O phpunit https://phar.phpunit.de/phpunit-7.phar\nchmod +x phpunit\nsudo yum  install php-xdebug\n```\n\n---\n## for database connection\n\n```bash\n# env var\nDB_CONNECTION=mysql\nDB_PORT=3306\n\n# bash\nsudo vi /etc/mysql/mysql.conf.d/mysqld.cnf\n# change bind-address from 127.0.0.1 to 0.0.0.0 \n\n\nsudo yum install mysql-client -y\n```\n\n\u003e Learn how to install Jenkins [here](https://www.jenkins.io/doc/book/installing/)\n\n\u003e Learn how to installk artifactory [here](https://jfrog.com/open-source/)\n\n---\n\n## Jenkinsfile for Quick Task\n\n```\n  pipeline {\n    agent any\n\n  stages {\n    stage(\"Initial cleanup\") {\n          steps {\n            dir(\"${WORKSPACE}\") {\n              deleteDir()\n            }\n          }\n        }\n    stage('Build') {\n      steps {\n        script {\n          sh 'echo \"Building Stage\"'\n        }\n      }\n    }\n\n    stage('Test') {\n      steps {\n        script {\n          sh 'echo \"Testing Stage\"'\n        }\n      }\n    }\n\n    stage('Package'){\n      steps {\n        script {\n          sh 'echo \"Packaging App\" '\n        }\n      }\n    }\n\n    stage('Deploy'){\n      steps {\n        script {\n          sh 'echo \"Deploying to Dev\"'\n        }\n      }\n\n    }\n    \n    stage(\"clean Up\"){\n       steps {\n        cleanWs()\n     }\n    }\n     \n    }\n}\n```\n\n---\n\n## Sonar properties\n\n```\nsonar.host.url=http://3.125.17.131:9000/sonar/\nsonar.projectKey=php-todo\n#----- Default source code encoding\nsonar.sourceEncoding=UTF-8\nsonar.php.exclusions=**/vendor/**\nsonar.php.coverage.reportPaths=build/logs/clover.xml\nsonar.php.tests.reportPath=build/logs/junit.xml\n```\n\n---\n\n## Jenkinsfile for PHP Todo Job\n\n```\npipeline {\n    agent any\n\n  stages {\n\n     stage(\"Initial cleanup\") {\n          steps {\n            dir(\"${WORKSPACE}\") {\n              deleteDir()\n            }\n          }\n        }\n\n    stage('Checkout SCM') {\n      steps {\n            git branch: 'main', url: 'https://github.com/Livingstone95/php-todo.git'\n      }\n    }\n\n    stage('Prepare Dependencies') {\n      steps {\n             sh 'mv .env.sample .env'\n             sh 'composer install'\n             sh 'php artisan migrate'\n             sh 'php artisan db:seed'\n             sh 'php artisan key:generate'\n      }\n    }\n\n      stage('Execute Unit Tests') {\n      steps {\n             sh './vendor/bin/phpunit'\n      } \n  }\n  stage('Code Analysis') {\n  steps {\n        sh 'phploc app/ --log-csv build/logs/phploc.csv'\n\n  }\n}\n\nstage('Plot Code Coverage Report') {\n      steps {\n\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Lines of Code (LOC),Comment Lines of Code (CLOC),Non-Comment Lines of Code (NCLOC),Logical Lines of Code (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'A - Lines of code', yaxis: 'Lines of Code'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Directories,Files,Namespaces', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'B - Structures Containers', yaxis: 'Count'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Average Class Length (LLOC),Average Method Length (LLOC),Average Function Length (LLOC)', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'C - Average Length', yaxis: 'Average Lines of Code'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Cyclomatic Complexity / Lines of Code,Cyclomatic Complexity / Number of Methods ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'D - Relative Cyclomatic Complexity', yaxis: 'Cyclomatic Complexity by Structure'      \n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Classes,Abstract Classes,Concrete Classes', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'E - Types of Classes', yaxis: 'Count'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Methods,Non-Static Methods,Static Methods,Public Methods,Non-Public Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'F - Types of Methods', yaxis: 'Count'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Constants,Global Constants,Class Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'G - Types of Constants', yaxis: 'Count'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Test Classes,Test Methods', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'I - Testing', yaxis: 'Count'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Logical Lines of Code (LLOC),Classes Length (LLOC),Functions Length (LLOC),LLOC outside functions or classes ', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'AB - Code Structure by Logical Lines of Code', yaxis: 'Logical Lines of Code'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Functions,Named Functions,Anonymous Functions', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'H - Types of Functions', yaxis: 'Count'\n            plot csvFileName: 'plot-396c4a6b-b573-41e5-85d8-73613b2ffffb.csv', csvSeries: [[displayTableFlag: false, exclusionValues: 'Interfaces,Traits,Classes,Methods,Functions,Constants', file: 'build/logs/phploc.csv', inclusionFlag: 'INCLUDE_BY_STRING', url: '']], group: 'phploc', numBuilds: '100', style: 'line', title: 'BB - Structure Objects', yaxis: 'Count'\n\n      }\n    }\n\n    stage('SonarQube Quality Gate') {\n      when { branch pattern: \"^develop*|^hotfix*|^release*|^main*\", comparator: \"REGEXP\"}\n        environment {\n            scannerHome = tool 'SonarQubeScanner'\n        }\n        steps {\n            withSonarQubeEnv('sonarqube') {\n                sh \"${scannerHome}/bin/sonar-scanner -Dproject.settings=sonar-project.properties\"\n            }\n            timeout(time: 1, unit: 'MINUTES') {\n                waitForQualityGate abortPipeline: true\n            }\n        }\n    }\n\n    stage ('Package Artifact') {\n    steps {\n            sh 'zip -qr php-todo.zip ${WORKSPACE}/*'\n     }\n\n    }\n    stage ('Upload Artifact to Artifactory') {\n          steps {\n            script { \n                 def server = Artifactory.server 'artifactory-server'                 \n                 def uploadSpec = \"\"\"{\n                    \"files\": [\n                      {\n                       \"pattern\": \"php-todo.zip\",\n                       \"target\": \"PBL/php-todo\",\n                       \"props\": \"type=zip;status=ready\"\n\n                       }\n                    ]\n                 }\"\"\" \n\n                 server.upload spec: uploadSpec\n               }\n            }\n  \n        }\n\n  stage ('Deploy to Dev Environment') {\n    steps {\n    build job: 'ansible-config/main', parameters: [[$class: 'StringParameterValue', name: 'env', value: 'dev']], propagate: false, wait: true\n    }\n  }\n\n}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhack-light%2Fansible-config-mgt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhack-light%2Fansible-config-mgt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhack-light%2Fansible-config-mgt/lists"}