Skip to content

Instantly share code, notes, and snippets.

@Andy-Knight
Created April 14, 2021 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andy-Knight/dccbe6a8efc56d798acd0e50d16df938 to your computer and use it in GitHub Desktop.
Save Andy-Knight/dccbe6a8efc56d798acd0e50d16df938 to your computer and use it in GitHub Desktop.
# Install packages and configuration for 2tier-app database role
installDbRolePackages:
pkg.installed:
- pkgs:
- python
- httpd
startApache:
service.running:
- name: httpd
- enable: True
createDatabaseDirectory:
file.directory:
- name: /var/www/db
- user: apache
- group: apache
- dir_mode: 755
- file_mode: 755
- recurse:
- user
- group
- mode
directory.db:
sqlite3.table_present:
- db: /var/www/db/directory.db
- schema: CREATE TABLE 'directory' ("PhoneNumber" INTEGER, "FirstName" VARCHAR(30), "Surname" VARCHAR(25), "Department" VARCHAR(20))
seedDatabase:
module.run:
- name: sqlite3.modify
- db: /var/www/db/directory.db
- sql: "INSERT INTO 'directory' VALUES (441536222333,'John','Adams','Billing'), (441536444654,'Sarah','Williams','Sales')"
- require:
- sqlite3: directory.db
databaseAppFile:
file.managed:
- name: /var/www/cgi-bin/database.py
- source: salt://2tier-app/dbAppScript.py
- user: apache
- group: apache
- mode: 755
stopFirewall:
service.dead:
- name: firewalld
- enable: False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment