{"id":25074890,"url":"https://github.com/farisc0de/ansible-role-wordpress","last_synced_at":"2026-01-11T05:15:23.884Z","repository":{"id":272083145,"uuid":"915471603","full_name":"farisc0de/ansible-role-wordpress","owner":"farisc0de","description":"Ansible role prepares a directory for WordPress application deployment","archived":false,"fork":false,"pushed_at":"2025-01-15T17:27:09.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T08:47:25.469Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farisc0de.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-11T23:29:44.000Z","updated_at":"2025-01-15T17:27:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"81a43722-d1c1-4bd2-adf2-d404dacb603c","html_url":"https://github.com/farisc0de/ansible-role-wordpress","commit_stats":null,"previous_names":["farisc0de/ansible-role-wordpress"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farisc0de%2Fansible-role-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farisc0de%2Fansible-role-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farisc0de%2Fansible-role-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farisc0de%2Fansible-role-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farisc0de","download_url":"https://codeload.github.com/farisc0de/ansible-role-wordpress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246531983,"owners_count":20792735,"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":"2025-02-07T00:19:33.391Z","updated_at":"2026-01-11T05:15:23.858Z","avatar_url":"https://github.com/farisc0de.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress Pre-Deployment Role\n\nThis Ansible role prepares a server environment for WordPress deployment. It sets up the necessary directory structure, installs WP-CLI, and configures WordPress with a `wp-config.php` template.\n\n---\n\n## Features\n\n- **Directory Setup**: Creates the required WordPress directory structure:\n  - `wp-content/plugins`\n  - `wp-content/themes`\n  - `wp-content/uploads`\n  - `logs` (optional)\n  - `tmp` (optional)\n- **WP-CLI Installation**: Installs [WP-CLI](https://wp-cli.org/) and its tab completion script.\n- **Configuration Management**: Deploys a `wp-config.php` template with database credentials.\n- **Rollback Support**: Cleans up in case of deployment failure.\n- **Task Tags**: Includes tags for selective task execution (`setup`, `config`, `wordpress`, `rollback`).\n\n---\n\n## Role Variables\n\nThe role uses the following variables, with defaults provided where applicable:\n\n| Variable              | Default Value        | Description                               |\n| --------------------- | -------------------- | ----------------------------------------- |\n| `wordpress_base_path` | `/var/www/wordpress` | Base path for the WordPress installation. |\n| `deploy_user`         | `www-data`           | User who owns the WordPress files.        |\n| `deploy_group`        | `www-data`           | Group for WordPress file ownership.       |\n| `wordpress_debug`     | `false`              | Enables or disables WordPress debug mode. |\n| `cleanup_tmp`         | `true`               | Cleans the `tmp` directory.               |\n| `rollback`            | `false`              | Triggers rollback if set to `true`.       |\n\n### Prompted Variables\n\nDuring runtime, the role prompts for the following database credentials:\n\n- **`db_name`**: WordPress database name.\n- **`db_user`**: WordPress database username.\n- **`db_password`**: WordPress database password.\n\n---\n\n## Tags\n\nYou can use tags to execute specific parts of the role:\n\n| Tag         | Description                                           |\n| ----------- | ----------------------------------------------------- |\n| `setup`     | Prepares the directory structure and installs WP-CLI. |\n| `config`    | Configures WordPress (e.g., `wp-config.php`).         |\n| `wordpress` | Installs WP-CLI and its tab completions.              |\n| `rollback`  | Cleans up the WordPress environment.                  |\n\n---\n\n## Example Playbook\n\n```yaml\n---\n- name: Prepare WordPress environment\n  hosts: wordpress_servers\n  become: true\n  vars_prompt:\n    - name: \"db_name\"\n      prompt: \"Enter the WordPress database name\"\n      private: no\n    - name: \"db_user\"\n      prompt: \"Enter the WordPress database username\"\n      private: no\n    - name: \"db_password\"\n      prompt: \"Enter the WordPress database password\"\n      private: yes\n  roles:\n    - wordpress_folder_setup\n```\n\n---\n\n## Usage\n\n### 1. Run Full Setup\n\nExecute all tasks to prepare the WordPress environment:\n\n```bash\nansible-playbook wordpress_pre_deploy.yml\n```\n\n### 2. Selective Task Execution\n\nRun specific tasks using tags:\n\n- **Setup Tasks (e.g., directory creation and WP-CLI installation):**\n  ```bash\n  ansible-playbook wordpress_pre_deploy.yml --tags setup\n  ```\n- **Configure WordPress (e.g., `wp-config.php` deployment):**\n  ```bash\n  ansible-playbook wordpress_pre_deploy.yml --tags config\n  ```\n- **Install WP-CLI Only:**\n  ```bash\n  ansible-playbook wordpress_pre_deploy.yml --tags wordpress\n  ```\n\n### 3. Rollback Environment\n\nClean up the WordPress environment in case of deployment failure:\n\n```bash\nansible-playbook wordpress_pre_deploy.yml --extra-vars \"rollback=true\" --tags rollback\n```\n\n---\n\n## Dependencies\n\nNone.\n\n---\n\n## Directory Structure\n\nThe role creates the following directory structure under `{{ wordpress_base_path }}`:\n\n```\n/var/www/wordpress/\n├── wp-content/\n│   ├── plugins/\n│   ├── themes/\n│   └── uploads/\n├── logs/            # Optional\n├── tmp/             # Optional\n├── wp-config.php\n├── .htaccess        # Optional\n```\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## Author\n\n**Faris Alotaibi**  \nDevOps Engineer | [GitHub](https://www.itsfaris.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarisc0de%2Fansible-role-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarisc0de%2Fansible-role-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarisc0de%2Fansible-role-wordpress/lists"}